Ask Your Question

sagetex linebreak

asked 2020-08-16 14:11:31 +0100

dantetante gravatar image

When using the environment sagecommandline of sagetex with long number output, how can I get automatic line breaks? I already tried to change sagetex.sty (putting breaklines=true at several places), but nothing changed. Here is my minimal example: (p.s. I asked the same question also on tex.stackexchange)

a6paper, 11pt, oneside,

% !TEX TS-program = sage
% !TEX encoding = UTF-8 Unicode



sage: factorial(100)+1
sage: factorial(50)+1
sage: factorial(10)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2020-08-17 01:34:50 +0100

Emmanuel Charpentier gravatar image

updated 2020-08-17 01:56:40 +0100

That's more of a $\LaTeX$ than a Sage question, and could get a better answer in a (mailing list|newsgroup|forum|site) dedicated to $\LaTeX$...

My two cents :

  • Some $\LaTeX$ packages help with "long equations" ; breqn comes to mind, but there are probably others.

  • You may typeset manually : convert your "long" numerical output in a string, then chop it up in conveniently sized chunks, arrange them in a list, then generate in Sage a string representing a convenient $\LaTeX$ packaging of this list. See the example.tex in the $SAGE_LOCAL/share/texmf/tex/latex/sagetex/ directory of your distribution for inspiration (I'm thinking of the Pascal's triangle example).

But you should also reconsider the need for printing your "long number output". If you need a bedsheet to print it, ask yourself if your reader shall read said bedsheet ? Or are you attempting bragging ?


edit flag offensive delete link more


I really need long number output, because I work with cryptography and number theory stuff and people want to copy and paste.

dantetante gravatar imagedantetante ( 2020-08-20 18:22:48 +0100 )edit

answered 2020-08-20 18:20:59 +0100

dantetante gravatar image

updated 2020-09-03 07:26:14 +0100

I found a solution myself (and already posted it on tex.stackexchange). Here it is:

\documentclass[ DIV=16, a6paper, 11pt]{scrartcl} 
% arara: lualatex
% arara: sagetex
% arara: lualatex
% !TEX TS-program = sage
% !TEX encoding = UTF-8 Unicode
sage: factorial(50)
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools



Asked: 2020-08-16 14:11:31 +0100

Seen: 609 times

Last updated: Sep 03 '20