make sage use \dfrac instead of \frac
For example:
Is it possible to make latex( (2*x+3) / (2*x) ) return \dfrac{2 \, x + 3}{2 \, x} instead of \frac{2 \, x + 3}{2 \, x} ?
add a comment
Here is a hack for this, use the string s = latex( (2*x+3) / (2*x) ) and replace in it each occurrence of \frac with \dfrac:
sage: s = latex( (2*x+3) / (2*x) )
sage: s.replace( r'\frac', r'\dfrac' )
'\\dfrac{2 \\, x + 3}{2 \\, x}'
sage: print s.replace( r'\frac', r'\dfrac' )
\dfrac{2 \, x + 3}{2 \, x}
sage: import re
sage: re.sub( r'\frac', r'\dfrac', s )
'\\frac{2 \\, x + 3}{2 \\, x}'
sage: print re.sub( r'\frac', r'\dfrac', s )
\frac{2 \, x + 3}{2 \, x}
Asked: 2019-07-16 02:49:00 +0100
Seen: 344 times
Last updated: Jul 16 '19
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.