This question is probably not very specific for TeXstudio, since it has to do with command execution on a shell. Anyway, I want to set up TeXstudio to compile documents which either have *.tex or *.ltx as fileending. The default compilation command is:

pdflatex -synctex=1 -interaction=nonstopmode %.tex

I tried the following command which obviously works, but it's somehow a not very clean solution.

pdflatex -synctex=1 -interaction=nonstopmode %.tex \| pdflatex -synctex=1 -interaction=nonstopmode %.ltx

How can I get a compilation command that does not try to compile the non-existing file (for example foo.tex), but compiles the existing foo.ltx file?

EDIT: My system is Linux Mint 17.1 Cinnamon with the default bash shell.

  • As far as I know that is dependent on the shell that TeXstudio is evoking on your system - which not only makes it OS-dependent, but also (at least among UNIX systems) dependent on which shell you've set as your default (bash, sh, tcsh, ...). – Big-Blue May 20 '15 at 19:21
  • Yeah that's true. I'll add this information to the question. – Simon M. Laube May 21 '15 at 3:32
  • latexmk will not autodetect ltx files, though it will compile them if you pass them the file with extensions. Can someone try autolatex? That might work but I don't have python installed. – Canageek May 21 '15 at 4:13
  • I'm not using latexmk, or at least I don't know if Texstudio uses latexmk. – Simon M. Laube May 21 '15 at 5:09

Use the extended syntax ?... for filename formatting, i.e. in your case:

pdflatex -synctex=1 -interaction=nonstopmode "?me"

See also the explaination on special chars below the command configurations (needs to have advanced options enabled to see all the details):

Special chars

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.