Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I ask Copilot your question:just by curiosity are you able to answer this difficult question below from https://ask.sagemath.org (me I'm not able, I do not even understand the question ! :

and this is the answer he gave me:

💡 Solution Use TeXworks’s built-in variable "$fullname" instead of "$basename":

"$fullname" gives the full path to the .tex file.

You can convert it to a WSL-compatible path using wslpath.

So update the SageTeX tool like this:

Program: wsl.exe
Argument 1: sage
Argument 2: $(wslpath "$fullname" | sed 's/.tex$/.sagetex.sage/')

This command:

Converts the full Windows path to WSL format using wslpath.

Replaces .tex with .sagetex.sage using sed.

wsl.exe /usr/bin/sage /mnt/c/Users/zi/Desktop/sagetry/$basename.sagetex.sage

This works because /mnt/c/... is how WSL2 accesses Windows files. But the path is hardcoded to one specific folder (sagetry). So if the user moves their .tex file to another folder, the SageTeX processor won’t find it unless they manually update the path.