Render a number into LaTeX in a 2-column format, where the columns split
    immediately to the left of the decimal point. This gives nice alignment of
    numbers in a table.

def latexify_n2col(x, nplaces=None, **kwargs):
    """Render a number into LaTeX in a 2-column format, where the columns split
    immediately to the left of the decimal point. This gives nice alignment of
    numbers in a table.

    """
    if nplaces is not None:
        t = '%.*f' % (nplaces, x)
    else:
        t = '%f' % x

    if '.' not in t:
        return '$%s$ &' % t

    left, right = t.split('.')
    return '$%s$ & $.%s$' % (left, right)