def get_label(compound_name:str) -> str:
    """
    Convert the chemical composition to LaTeX notation.

    Parameters
    ----------
    compound_name : str
        A compound name, like 'Li2O'

    Returns
    -------
    str
        Chemical composition converted to LaTeX notation.
    
    Examples
    --------
    >>> get_label('Li2O')
    'Li$_{2}$O'

    >>> get_label('(LiLa)0.5TiO3')
    '(LiLa)$_{0.5}$TiO$_{3}$'

    Raises
    ------
    ValueError
        when `compound_name` is not str.
    """
    if not isinstance(compound_name, str):
        raise ValueError('The `compound_name` must be string.')
    f = '$_{'
    b = '}$'
    N = len(compound_name)
    lst_compound_name = list(compound_name) + ['']   # outputするために変えていく．

    # １文字ずつ取り出して
    i = 0
    while i < N:
        l = compound_name[i] # l: letter
        if l.isdigit():
            j = i + 1
            while j < N + 1:
                try:
                    float(compound_name[i:j])
                except ValueError:
                    break
                else:
                    j += 1
            j -= 1
            lst_compound_name[i] = f + lst_compound_name[i]
            lst_compound_name[j] = b + lst_compound_name[j]
            i = j
        i += 1
    return ''.join(lst_compound_name)