Ask Your Question
0

wrapping an arbitrary lon equation

asked 2023-01-04 13:59:55 +0100

moon gravatar image

In sage with the latex function, the question of getting an equation wrapped into multiple lines has been largely covered for all the cases where you know exatly what your equation will look like. My issue is when the equation can be insanely long without any way to control it, as it's part of a different process. I'll appreciate hints or even solutions from those who have been thru or may be from who's got an idea. Many thx in advance. ps: anything that works with overleaf and/or texShop (whatever this may require) is more than welcome M

As an example :

a=set([3,9,11,23])
print(latex(Permutations(a).list()))
print(latex(Combinations(a,3).list()))

One can see that for this very basic example that the content do not wrap. What am I doing wrong ? any hints? thx in advance M ps: In practice I just send the print to a file. here the purpose is to show what I'm talking about. Hope it make sens. ps: ENV = Montery (MacOS) + sagemath 9.7 + overleaf + TexShop

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-01-04 20:09:10 +0100

Emmanuel Charpentier gravatar image

updated 2023-01-04 20:11:22 +0100

There is probably no "general" xolution to your problem. breqn attempt this for "regular" mathematical expression, but I'm not convinced it would work with your case (yourv permutation elements are not regular LaTeX "math ob jects...

Possible workaround in your specific case :

sage: a=set([3, 9, 11, 23])
sage: print("\\begin{verbatim}\n%s\n\\end{verbatim}"%"\n".join([str(u) for u in Permutations(a)]))
\begin{verbatim}
[11, 9, 3, 23]
[11, 9, 23, 3]

[ Snip... ]

[23, 3, 11, 9]
[23, 3, 9, 11]
\end{verbatim}

Otherwise, SageTeX may be your friend...

edit flag offensive delete link more

Comments

Thx Emmanuel for this answer. In fact this is what I'm doing thru appropriate formatting however I do not benefit from the full line width. It look like I need to develop a specific function that splits the expressions based on the length .... this will not look correct but at least i'll be able to see the results:equations.

moon gravatar imagemoon ( 2023-01-04 23:44:48 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2023-01-04 13:59:55 +0100

Seen: 211 times

Last updated: Jan 04 '23