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
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}
?
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}
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2019-07-16 02:49:00 +0200
Seen: 288 times
Last updated: Jul 16 '19