Ask Your Question

Diaa's profile - activity

2020-08-04 20:49:00 +0200 commented question Configuring an arara rule of sagetex on Windows 10

@dan_fulea The same document can be compiled successfully without errors from the sage shell. So, apparently, the command prompt syntax needs some fixes.

2020-08-04 00:10:10 +0200 asked a question Configuring an arara rule of sagetex on Windows 10

This question has been cross-posted on here https://tex[dot]stackexchange[dot]com/q/557131/2288 (https://tex[dot]stackexchange[dot]com...).

When using the following sagetex.yaml arara rule

# SageTeX-Rule for arara.
identifier: sagetex
name: SageTeX
- TeXnician (Author)
- cis (Idea)
arguments: []
- 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



    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:
        f(x) = exp(x) * sin(2*x)

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

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')"