ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 07 Jul 2015 15:43:38 -0500sagetex with breqn ? break line sagetex equationshttp://ask.sagemath.org/question/27259/sagetex-with-breqn-break-line-sagetex-equations/Hi everyone,
When using sagetex, it often produces very long equations that are not visible anymore because they go over the page width.
How to fix that?
I could work around it by loading the .sagetex.sage into a sage session, then produce latex code with latex(functionname) and then break this code manually but it would be against the spirit of sagetex.
I tried the breqn environment but it does not work, e.g.
\documentclass{article}
\usepackage{sagetex}
\usepackage{breqn}
\begin{document}
\begin{sagesilent}
var('d,epsilon,mu,z,M,e,m')
delta = (1-z)*( gamma(2-d/2)/( (1-z)^2*m^2+z*M^2 )^(2-d/2) *(2-epsilon)^2/2 + gamma(3-d/2)/( (1-z)^2*m^2+z*M^2 )^(3-d/2) * ( 2*(1-4*z+z^2)-epsilon*(1-z)^2 )*m^2 )
\end{sagesilent}
\begin{dmath}
\sage{delta.diff(m).subs(m==mu)}
\end{dmath}
\end{document}
produces an equation that has no line breaks. I cannot use environments like split or align to fix it because I cannot directly modify the latex code, or, if I would via sage, it would not be convenient anymore to use sagetex.
Any help would be appreciated. Thank you!Sat, 04 Jul 2015 06:09:25 -0500http://ask.sagemath.org/question/27259/sagetex-with-breqn-break-line-sagetex-equations/Comment by SagExchange for <p>Hi everyone,</p>
<p>When using sagetex, it often produces very long equations that are not visible anymore because they go over the page width.</p>
<p>How to fix that?</p>
<p>I could work around it by loading the .sagetex.sage into a sage session, then produce latex code with latex(functionname) and then break this code manually but it would be against the spirit of sagetex.</p>
<p>I tried the breqn environment but it does not work, e.g.</p>
<pre><code>\documentclass{article}
\usepackage{sagetex}
\usepackage{breqn}
\begin{document}
\begin{sagesilent}
var('d,epsilon,mu,z,M,e,m')
delta = (1-z)*( gamma(2-d/2)/( (1-z)^2*m^2+z*M^2 )^(2-d/2) *(2-epsilon)^2/2 + gamma(3-d/2)/( (1-z)^2*m^2+z*M^2 )^(3-d/2) * ( 2*(1-4*z+z^2)-epsilon*(1-z)^2 )*m^2 )
\end{sagesilent}
\begin{dmath}
\sage{delta.diff(m).subs(m==mu)}
\end{dmath}
\end{document}
</code></pre>
<p>produces an equation that has no line breaks. I cannot use environments like split or align to fix it because I cannot directly modify the latex code, or, if I would via sage, it would not be convenient anymore to use sagetex.</p>
<p>Any help would be appreciated. Thank you!</p>
http://ask.sagemath.org/question/27259/sagetex-with-breqn-break-line-sagetex-equations/?comment=27272#post-id-27272Hi again,
I know now that the reason is that the generated latex code from sage contains a lot of {\\left and \\right)} that should be deleted. But I cant write any macro in Latex that removes { or } because they are themselves trigger parameters... So the deletion of { and } should come from sage before handing the code to latex. Any suggestions on how to do that?Tue, 07 Jul 2015 15:43:38 -0500http://ask.sagemath.org/question/27259/sagetex-with-breqn-break-line-sagetex-equations/?comment=27272#post-id-27272