If you use arara, known as "The cool TeX-automatisation Tool", written by @PauloCereda, you can set compilation instructions into your tex-document, i.e.
% arara: pdflatex
% arara: biber
.....
and then only one run arara example.tex
is needed.
In TeXLive arara is installed by default. You can also integrate arara into your TeX editor.
There is no arara-rule for Sage in the main set of arara-rules, but it has been written:
See the original post arara: sage - A Sage(math)-rule for arara
It is sagetex.yaml
, which works for Windows-users and for Linux-users:
!config
# SageTeX-Rule for arara.
#
# Dear Windows-users, please check the paths
# pathToBashExecutive and pathToSageStartfile
# due to your Sage-installation!
#
identifier: sagetex
name: SageTeX
authors:
- TeXnician (Author)
- cis (Idea)
arguments: []
commands:
- name: A SageTeX Rule for arara
command: >
@{
pathToBashExecutive = "C:\\Programme\\SageMath8.9\\runtime\\bin\\bash";
pathToSageStartfile = "C:/Programme/SageMath8.9/runtime/opt/sagemath-8.9/sage";
pathOfCurrentWorkingFolder = currentFile().getParent();
theWindowsCommand = getCommand(pathToBashExecutive, "-l", pathToSageStartfile, "-c", "os.chdir('" + pathOfCurrentWorkingFolder + "'); load('" + getBasename(currentFile()) + ".sagetex.sage')");
return isWindows(theWindowsCommand, getCommand("sage", getBasename(file) + ".sagetex.sage"));
}
Let's test an example.tex
% arara: pdflatex
% arara: sagetex
% arara: pdflatex
\documentclass{report}
\usepackage{sagetex}
\begin{document}
\sage{2^1234}
\end{document}