First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Typesetting with LaTeX and SageTeX

Given a document something.tex using SageTeX, the steps for typesetting are:

  • one round of typesetting with latex

    for instance with this terminal command:

    $ pdflatex something.tex

    This produces a file something.sagetex.sage.

  • one round of running Sage on that file

    for instance with this terminal command:

    $ sage something.sagetex.sage

    This requires sage to be somewhere in your PATH.

    This prepares all the Sage output for the next round of typesetting.

  • two rounds of typesetting with latex

    for instance with this terminal command:

    $ pdflatex something.tex
    $ pdflatex something.tex

    This produces the desired file something.pdf.

What if sage is not in my PATH?

Here is one way to get it there.

  • start Sage

  • in Sage, run this command:

    sage: !sudo ln -sf $SAGE_ROOT/sage /usr/local/bin
  • type in the password for your user account on your mac

  • quit Sage