Ask Your Question
1

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

asked 2020-01-05 18:36:10 +0200

geroyx gravatar image

updated 2020-01-05 18:44:29 +0200

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
2

answered 2020-01-09 22:24:25 +0200

Sébastien gravatar image

updated 2020-01-09 22:44:54 +0200

One may also write

default:
    pdflatex example.tex
sage:
    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
1

answered 2020-01-05 18:36:36 +0200

geroyx gravatar image

updated 2020-01-09 20:21:11 +0200

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}
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

Stats

Asked: 2020-01-05 18:36:10 +0200

Seen: 408 times

Last updated: Jan 09 '20