3

I use LaTex a lot in Ubuntu 14.04. Recently I came to know about the sagetex package and installed sage-6.8-x86_64-Linux . Suppose the tex file is example.tex , then one has to run the following commanda to make it work.

pdflatex example.tex
sage example.sagetex.sage
pdflatex example.tex

Now I want to do run these commands from Texmaker. So I go to the menu and then Options → Configure → QuickBuild → User and define there (in User) these three commands. I used the following pipeline

pdflatex -synctex=1 -interaction=nonstopmode %.tex | sage %.sagetex.sage | pdflatex -synctex=1 -interaction=nonstopmode %.tex

After that when I run Quick Build on the file from texmaker, I get a error message,

Error : could not start the command

I want to know why the Quick Build command does not work ? also if anyone could help me so that I could run those command from Texmaker.

  • Is there no other error message? What happens when you only keep the first part pdflatex -synctex=1 -interaction=nonstopmode %.tex and remove the rest? – jarauh Oct 25 '15 at 13:10
  • Nope. no other error message. It is fine when I run only the first command. Then it just do what pdflatex do. But after that a example.sagetex.sage file is created. Then I have to run the sage command on that file. At last again pdflatex. This is how sagetex works. – ddas Oct 25 '15 at 16:16
  • Your question seems similar to this one. In particular, make sure you read comments where the same error is given and two solutions: one works for me but not for Jason who leaves a comment (find "99%") about what he did to get it to work for him. Does it help? How is your problem different? – DJP Oct 25 '15 at 17:27
  • Hi @DJP. Thanks for your reply. After @Dan's idea, I have figured out whats was going wrong with my Quickbuild command. I have to write the whole path of the command sage in Texmaker. I replace my pipeline in Options → Configure → QuickBuild → User with pdflatex -synctex=1 -interaction=nonstopmode %.tex | /home/ddas/sage-6.8-x86_64-Linux/sage %.sagetex.sage | pdflatex -synctex=1 -interaction=nonstopmode %.tex . And that also worked for me. Thank you guys.. – ddas Oct 26 '15 at 8:30
2

One way to work around this is to put all the commands you want into a script and just have Texmaker run the script. I downloaded Texmaker and got this working with the following script:

#!/bin/sh

pdflatex $1.tex && sage $1.sagetex.sage && pdflatex $1.tex

Make the script executable -- do chmod a+x your-scripts-name in a terminal -- and then in the Quick Build options, just put /path/to/your-scripts-name % . That worked for me.

One reason I like using a separate script is that I know exactly how it will work. Texmaker's use of the pipe character (|) to separate commands is a bit weird; if I put && in the script, I know that if one command fails, it will not continue to try the other commands. This script will even work well for TeX files that don't use SageTeX: it will run the pdflatex command, then try the Sage command, which will fail because there's no .sagetex.sage file, and then the script will skip the second pdflatex.

  • Hi @Dan. Your method works for me. It is surely better to write our own script. – ddas Oct 26 '15 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.