TransWikia.com

sagetex linebreak

TeX - LaTeX Asked by dantetante on June 5, 2021

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:

documentclass[
a6paper, 11pt, oneside,
english,ngerman]{scrartcl} 

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

usepackage[headsep=0cm,footskip=1.5em,includeheadfoot=true,
top=0cm,bottom=0cm,left=.5cm,right=.5cm,]{geometry}
usepackage{sagetex}

lstdefinestyle{SageOutput}{style=DefaultSageOutput,breaklines=true}

begin{document}
begin{sagecommandline}
sage: factorial(100)+1
sage: factorial(50)+1
sage: factorial(10)
end{sagecommandline}
end{document}

One Answer

Yes I can ... I found a solution myself:

documentclass[ DIV=16, a6paper, 11pt]{scrartcl} 
% arara: lualatex
% arara: sagetex
% arara: lualatex
% !TEX TS-program = sage
% !TEX encoding = UTF-8 Unicode
usepackage{seqsplit}
usepackage{sagetex}
lstset{
literate=
{1}{1allowbreak}1
{2}{2allowbreak}1
{3}{3allowbreak}1
{4}{4allowbreak}1
{5}{5allowbreak}1
{6}{6allowbreak}1
{7}{7allowbreak}1
{8}{8allowbreak}1
{9}{9allowbreak}1
{0}{0allowbreak}1,
breaklines=true}
begin{document}
begin{sagecommandline}
sage: factorial(50)
end{sagecommandline}
seqsplit{%
30414093201713378043612608166064768844377641568960512000000000000}
end{document}

Answered by dantetante on June 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP