Skip to content

Add srepl environment for sage repl sessions, and ability to parse png images

miguelmarco requested to merge miguelmarco/texsurgery:master into master

A small christmass present:

This PR adds the ability to parse base64/png images in the kernel answer, and includes them inside an includegraphics environment.

It also adds a new environment called srepl (i t means sage read-eval-print-loop, but maybe it is a very bad name... couldn't find anything better) that allows to embed in the tex document what would happen in an interactive command line sage session.

So, for instance, the latex code:

\begin{srepl}
1+1
sin(pi)
for i in [1,2,3]:
    print(i^2)
    if i>1:
        print(i)
\end{srepl}

would be converted to:

\begin{verbatim}
sage: 1+1
2
sage: sin(pi)
0
sage: for i in [1,2,3]:
....:     print(i^2)
....:     if i>1:
....:         print(i)
1
4
2
9
3

\end{verbatim}

Merge request reports