sagetex with breqn ? break line sagetex equations

asked 2015-07-04 13:09:25 +0200

SagExchange gravatar image

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!

edit retag flag offensive close merge delete

Comments

Hi 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?

SagExchange gravatar imageSagExchange ( 2015-07-07 22:43:38 +0200 )edit