ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 03 Aug 2020 16:10:57 -0500Configuring an arara rule of sagetex on Windows 10https://ask.sagemath.org/question/52840/configuring-an-arara-rule-of-sagetex-on-windows-10/ This question has been cross-posted on tex.sx here https://tex[dot]stackexchange[dot]com/q/557131/2288.
----------
When using the following `sagetex.yaml` arara rule
!config
# SageTeX-Rule for arara.
identifier: sagetex
name: SageTeX
authors:
- TeXnician (Author)
- cis (Idea)
arguments: []
commands:
- name: A SageTeX Rule for arara
command: >
@{
pathToBashExecutive = "C:\\Program Files\\SageMath 9.1\\runtime\\bin\\bash";
pathToSageStartfile = "C:/Program Files/SageMath 9.1/runtime/opt/sagemath-9.1/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"));
}
to compile the following document
% arara: lualatex
% arara: sagetex
% arara: lualatex
\documentclass{article}
\usepackage{sagetex}
\begin{document}
Using Sage\TeX, one can use Sage to compute things and put them into your \LaTeX{} document. For example, there are
$\sage{number_of_partitions(1269)}$ integer partitions of $1269$.
You don't need to compute the number yourself, or even cut and paste it from somewhere.
Here's some Sage code:
\begin{sageblock}
f(x) = exp(x) * sin(2*x)
\end{sageblock}
The second derivative of $f$ is
\[
\frac{\mathrm{d}^{2}}{\mathrm{d}x^{2}} \sage{f(x)} =
\sage{diff(f, x, 2)(x)}.
\]
Here's a plot of $f$ from $-1$ to $1$:
\sageplot{plot(f, -1, 1)}
\end{document}
I get this error
> SyntaxError: (unicode error)
> 'unicodeescape' codec can't decode
> bytes in position 2-3: truncated
> \UXXXXXXXX escape
So, what should be changed in both the arara rule and, consequently, the following command to make everything work?
"C:\Program Files\SageMath 9.1\runtime\bin\bash" -l "C:/Program Files/SageMath 9.1/runtime/opt/sagemath-9.1/sage" -c "os.chdir('C:\Users\Diaa\Desktop\Test'); load('testsagetex.sagetex.sage')"DiaaMon, 03 Aug 2020 16:10:57 -0500https://ask.sagemath.org/question/52840/