def to_latex(var):
    """Returns a latex representation for a given variable string name.

    Parameters
    ----------
    var : string
        One of the variable names used in the bicycleparameters package.

    Returns
    -------
    latex : string
        A string formatting for pretty LaTeX math print.

    """

    latexMap = {'f': 'f',
                'w': 'w',
                'gamma': '\gamma',
                'g': 'g',
                'lcs': 'l_{cs}',
                'hbb': 'h_{bb}',
                'lsp': 'l_{sp}',
                'lst': 'l_{st}',
                'lamst': '\lambda_{st}',
                'whb': 'w_{hb}',
                'LhbF': 'l_{hbF}',
                'LhbR': 'l_{hbR}',
                'd': 'd',
                'l': 'l',
                'c': 'c',
                'lam': '\lambda',
                'xcl': 'x_{cl}',
                'zcl': 'z_{cl}',
                'ds1': 'd_{s1}',
                'ds3': 'd_{s3}'}
    try:
        latex = latexMap[var]
    except KeyError:
        if var.startswith('alpha'):
            latex = r'\alpha_{' + var[-2:] + '}'
        elif var.startswith('a') and len(var) == 3:
            latex = 'a_{' + var[-2:] + '}'
        elif var.startswith('T'):
            latex = 'T^' + var[1] + '_{' + var[-2:] + '}'
        elif len(var) == 2:
            latex = var[0] + '_' + var[1]
        elif var.startswith('I'):
            latex = var[0] + '_{' + var[1:] + '}'
        else:
            raise

    return latex