sagetex: Embed code, results of computations, and plots from Sage into LaTeX documents#


The SageTeX package allows you to embed code, results of computations, and plots from Sage into LaTeX documents.


The source code of the SageTeX package may be redistributed and/or modified under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. To view a copy of this license, see or send a letter to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

The documentation of the SageTeX package is licensed under the Creative Commons Attribution-Share Alike 3.0 License. To view a copy of this license, visit or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

SPKG Maintainers#

Dan Drake (dr.dan.drake at gmail) and SageMath developers (

Upstream Contact#

Author: Dan Drake.



To install, nothing more than a standard Sage install. The spkg-check script will exit without actually testing anything if it cannot find “latex” in your path.


To use SageTeX, both Sage and LaTeX need to know about it. SageTeX comes standard with Sage, so you only need to make sure LaTeX can find what it needs. Full details are in the Sage installation guide at and .

The directory $SAGE_ROOT/venv/share/doc/sagetex contains documentation and an example file. See $SAGE_ROOT/venv/share/texmf/tex/latex/sagetex for the source code and some possibly useful scripts. If you have problems or suggestions see the sage-support group.

If you want to help develop SageTeX, please clone the github repository (see the “Upstream Contact” above) and send me patches based on that.




Version Information#




sagetex >=3.5

Equivalent System Packages#

$ conda install sagetex


However, these system packages will not be used for building Sage because spkg-configure.m4 has not been written for this package; see github issue #27330 for more information.