TeX - LaTeX Asked by cis on September 17, 2020
Completely edited!
The normal run of a tex-file which contains sagetex, say
documentclass{report}
usepackage{sagetex}
begin{document}
sage{2^1234}
end{document}
is
pfdlatex example.tex
sage example.sagetex.sage
pfdlatex example.tex
For Linux this should run in exactly this form.
For Windows you have to compile the sage-part (2nd line) via
C:ProgrammeSageMath8.9runtimebinbash
-l C:/Programme/SageMath8.9/runtime/opt/sagemath-8.9/sage
-c "os.chdir('<My current working folder>');
load('<my filename>.sagetex.sage')"
(without linebreaks), see here for details.
How to make a shortcut (for Windows and Linux) of this with arara?
My own try sagetex.yaml
does not work 🙁
!config
identifier: sagetex
name: SageTeX
# Authors:
# Version:
# ===============================
# Info: The Windows cmd-command is
# C:ProgrammeSageMath8.9runtimebinbash
# -l C:/Programme/SageMath8.9/runtime/opt/sagemath-8.9/sage
# -c "os.chdir('<My current working folder>');
# load('<my filename>.sagetex.sage')"
#For Windows =========================
arguments:
- identifier: PathToBashExecutive
flag: >
@{
return C:ProgrammeSageMath8.9runtimebinbash
}
- identifier: PathToSageStartfile
flag: >
@{
return C:/Programme/SageMath8.9/runtime/opt/sagemath-8.9/sage
}
- identifier: PathOfCurrentWorkingFolder
flag: >
@{
return getBasename(toFile('getBasename(file).tex'));
}
- identifier: TheWindowsCommand
flag: >
@{
return 'PathToBashExecutive' -l 'PathToSageStartfile' -c "os.chdir('PathOfCurrentWorkingFolder'); load('getBasename(file).sagetex.sage')"
}
# ===============================
commands:
- name: The application
command: >
@{
return isWindows(TheWindowsCommand, sage getBasename(file).sagetex.sage);
}
In cooperation with the OP I did come up with the following:
!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"));
}
arara 5.0
!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(reference) + ".sagetex.sage"));
}
Correct answer by TeXnician on September 17, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP