Ask Your Question

Introduction: A shortcut for the compiling of SageTeX-files with arara

asked 2020-01-05 11:36:10 -0600

geroyx gravatar image

updated 2020-01-05 11:44:29 -0600

Note: This is a meta-post, so no answers are needed. I will answer it by myself.

My dearest SageTeXers, Sagers, arara-users and Pythoners as well!

The normal way to compile a file example.tex which contains SageTeX is

pdflatex example.tex
sage example.sagetex.sage
pdflatex example.tex

So the initial question is: How to make a shortcut for this?

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2020-01-09 15:24:25 -0600

Sébastien gravatar image

updated 2020-01-09 15:44:54 -0600

One may also write

    pdflatex example.tex
    pdflatex example.tex
    sage example.sagetex.sage
    pdflatex example.tex

in a file called makefile in the same directory and then run make or make sage. (I think the four spaces must really be tabulations)

edit flag offensive delete link more

answered 2020-01-05 11:36:36 -0600

geroyx gravatar image

updated 2020-01-09 13:21:11 -0600

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:

# SageTeX-Rule for arara.
# Dear Windows-users, please check the paths
# pathToBashExecutive    and    pathToSageStartfile
# due to your Sage-installation!
identifier: sagetex
name: SageTeX
- TeXnician (Author)
- cis (Idea)
arguments: []
- 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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-01-05 11:36:10 -0600

Seen: 105 times

Last updated: Jan 09