I am running into a problem where Texstudio is only running the first command of a list of commands, and I am wondering if I am doing something wrong. Here is a minimal working example so you can see what I mean.
Minimal working example
First I will configure texstudio so it produces the error, then I will go through the steps to produce the strange behavior.
Configuring texstudio
Create a new folder test
and create a file test.tex
with contents
\documentclass{article}
\begin{document}
test
\end{document}
Now open test.tex
with texstudio, and in the texstudio menu, go to options>configure texstudio..., click on the commands tab in the left pane, and change the command for PdfLatex (the second in the list of commands for me) to
ls | pdflatex -synctex=1 -interaction=nonstopmode %.tex
This command is different from the default texstudio's default pdflatex command because of the addition of ls |
. Of course ls
is the usual thing you type into a terminal. It serves no purpose here other than to be a dummy command. |
is used to seperate multiple commands if you have a list of commands you want to run, as desribed here in the third sentence of the second paragraph.
To test that everything is configured properly, in the texstudio menu, go to Tools>Commands>PDFLaTeX. On my system, the file compiles as usual, and you get the expected output. In the message output, you should see
Process started: ls
Process exited normally
Process started: pdflatex -synctex=1 -interaction=nonstopmode "texTemplate".tex
Process exited normally
You see that there are two processes: one for ls
and one for pdflatex
Producing the strange behavior
Now that everything is configured, we are ready to produce the strange behavior. The first step here exhibits normal behavior but is necessary to produce the strange behavior. In test.tex
, change "test" to "te\st", so that text.tex now looks like
\documentclass{article}
\begin{document}
te\st
\end{document}
As you did in the configuration section, run Tools>Commands>PDFLaTeX. This time the source file contains an error, so we expected Texstudio to tell us about the error, and indeed this is what happens, so there is nothing strange here. From "messages" in texstudio, we see
Process started: ls
Process exited normally
Process started: pdflatex -synctex=1 -interaction=nonstopmode "texTemplate".tex
Process exited with error(s)
Now, go and revert text.tex
back to its orginal contents (that is, change "te\st" back to "test"). Then, run Tools>Commands>PDFLaTeX. Now things get interesting. It shows us the log as if we did not change back to "test". Looking at "messages" in textstudio, we see why texstudio does this. The "messages" output is
Process started: ls
Process exited normally
Only ls
run. pdflatex
never ran, so the log file never changed. Now, certainly you can compile the file with texstudio if you erase all the files except for test.tex
and then restart texstudio. In fact, it is only necessary to delete the log file and restart texstudio.
So my question is, how is it possible to have texstudio run all the commands regardless if there are errors in the source file? Am I doing something wrong or is this a bug with texstudio.