Ask Your Question

How to use Sagetex with windows?

asked 2017-11-27 03:14:02 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Installed Virtual Box on my computer to run Sage-8.0. Used MiKTeX_2.9;

For me, the following code:



For example, there are
integer partitions of $1269$.


Gives this output:

For example, there are ?? integer partitions of 1269.

Can anyone please give me a specific tutorial to fix this? Much appreciated!!!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-11-27 09:51:26 -0500

Emmanuel Charpentier gravatar image

To get the result you expect from Sage\TeX (e. g. in a file named, you have to :

  1. \LaTeX your .tex file (i. e. pdflatex foo.tex : the \sagexxx macros will generate a Sage program foo.sagetex.sage and (via the foo.aux file) leave _references_ to the sage outputs, which are yet to be generated ; these (unfilled) references will print as ?? in the output file.

  2. Execute your Sage program (i. e. sage foo.sagetex.sage). This will compute the outputs, place them in specific files, and, IIRC, update the foo.aux file.

  3. Re-\LaTeX your .tex file ; now that the Sage outputs exist and are referenceg in foo.aux, they will be inserted in your output PDF.

All of this is well-documented in $SAGE_ROOT/local/share/texmf/tex/latex/sagetex/sagetex.tex ; reading and modifying $SAGE_ROOT/local/share/texmf/tex/latex/sagetex/example.tex is also useful.

Now, since you use MikTeX (a Windows port of \LaTeX), you have to work both from Windows (to execute pdflatex) and from the Linux VM (to run sage), unless you have managed to create a Windows link able to call Sage from a Windows command line. Thes two have to work on the same directory (for example by creating a shared directory and cding to it from both sides).


edit flag offensive delete link more


FYI, Sagemath 8 is ported to Windows, released this summer :)

PHPirates gravatar imagePHPirates ( 2017-12-14 12:01:59 -0500 )edit

what do you mean by 1.\LaTeX your .tex file ?? what command do I have to use ? (I'm under the prompt sage: in a command shell SageMath Linux VM) I would like to create a pdf from the file example.tex

sage: pwd
ortollj gravatar imageortollj ( 2018-02-14 00:49:46 -0500 )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


Asked: 2017-11-27 03:14:02 -0500

Seen: 234 times

Last updated: Nov 27 '17