def render_frac(numerator, denominator):
 if (len(numerator) == 1):
  num_latex = numerator[0].sans_parens
 else:
  num_latex = '\\cdot '.join((k.latex for k in numerator))
 if (len(denominator) == 1):
  den_latex = denominator[0].sans_parens
 else:
  den_latex = '\\cdot '.join((k.latex for k in denominator))
 latex = u'\\frac{{{num}}}{{{den}}}'.format(num=num_latex, den=den_latex)
 return latex

def render_frac ( numerator , denominator ) : if ( len ( numerator ) == 1 ) : num_latex = numerator [ 0 ] . sans_parens else : num_latex = '\\cdot ' . join ( ( k . latex for k in numerator ) ) if ( len ( denominator ) == 1 ) : den_latex = denominator [ 0 ] . sans_parens else : den_latex = '\\cdot ' . join ( ( k . latex for k in denominator ) ) latex = u'\\frac{{{num}}}{{{den}}}' . format ( num = num_latex , den = den_latex ) return latex
given a list of elements in the numerator and denominator .