def common_texification(text):
 text = re_mathdefault.sub(repl_mathdefault, text)
 parts = re_mathsep.split(text)
 for (i, s) in enumerate(parts):
  if (not (i % 2)):
   s = re_escapetext.sub(repl_escapetext, s)
  else:
   s = (u'\\(\\displaystyle %s\\)' % s)
  parts[i] = s
 return u''.join(parts)

def common_texification ( text ) : text = re_mathdefault . sub ( repl_mathdefault , text ) parts = re_mathsep . split ( text ) for ( i , s ) in enumerate ( parts ) : if ( not ( i % 2 ) ) : s = re_escapetext . sub ( repl_escapetext , s ) else : s = ( u'\\(\\displaystyle %s\\)' % s ) parts [ i ] = s return u'' . join ( parts )
do some necessary and/or useful substitutions for texts to be included in latex documents .