Chapter 3 LaTeX with SageMath

LaTeX on its own does not have computational functions. When the writing involves calculations, we do the calculations in somewhere else before copy and paste the result to LaTeX.

The Sagetex package, which uses the open source program SageMath, gives LaTeX the computational power so that we can write and compute at the same place.

For example, with proper installation of the package, the following LaTeX code

The factorial of 10 is $\sage{factorial(10)}$.

will be compiled to

The factorial of 10 is 3628800.

The Sagetex package was first available in 2008.