4.3.2 Testing LaTeX Documentation

Run sage -t <filename.tex> to test the examples in verbatim environments in LaTeX documentation. Put %skip on the line right before a verbatim environment to have that example skipped when testing the file.

Sage creates a file .doctest_filename.py and tests it just as for .py, .pyx and .sage files. In order to skip testing of a block of code in a verbatim environment, put the LaTeX comment %skip on the previous line.

One difference is that in LaTeX files one often inserts explanatory texts between different verbatim environments. To link together verbatim environments use the %link comment. For example

    \begin{verbatim}
    sage: a = 1
    \end{verbatim_}%link

    Next we add 1 to \code{a}.
    %link
    \begin{verbatim}
    sage: 1 + a
    2
    \end{verbatim_}

See SAGE_ROOT/doc/tut/tut.tex for many examples of how to include automated testing in LaTeX documentation for Sage.

See About this document... for information on suggesting changes.