I saw this closed question and I'm experienceing something similar: for .tex documents, when I press the f5 key, which triggers the macro "Build and view", I get an output .pdf file that is treated by Thunar as a "plain text" file; I doulbe-click on it and the text editor is executed. I use the embedded pdf viewer in TeXstudio.

Running pdflatex on a terminal or using another editor, the problem doesn't occur; even on TeXstudio, if I only use the Build macro and then the view command, I get a proper .pdf file.

I even ran the Build > View on the following file:




The Build > View command produced a proper PDF from the above.

Any ideas on how to know what is going on? Thank you!

2 Answers 2


F5 is the default shortcut for Build & View, check if this is your current shortcut in Options/Configure TeXstudio.../Shortcuts/Menus/Tools.

Build & View is defined in Options/Configure TeXstudio.../Build/Build & View. Please check the value of this. The default value is txs:///compile | txs:///view. If this is different, please set it back to that.

txs:///compile is defined just below Build & View, please check that the value is txs:///pdflatex

txs:///pdflatex is defined in Options/Configure TeXstudio.../Commands/PdfLaTeX and the default value is pdflatex -synctex=1 -interaction=nonstopmode %.tex. If this is different, please set it back to that.

If this does not solve, could you describe some more the "plain-text .pdf file" contents?

  • The configuration is as you describe it. I cannot tell you about the contents of the file because when trying to open it (on Mousepad, in my case) I get a window with the error "The document was not UTF-8 valid"; changing the encoding doesn't allow me to open it either. However, in trying to get into the contents, I typed on terminal cat output.pdf > output2.pdf (just as an example) and this produced a proper PDF file. Again, the faulted PDF is produced only when I run Build & View. Commented Feb 6, 2019 at 2:10
  • I can't understand how this could happen, there seems to be a problem with TeXstudio as one button works and the other doesn't and there seems to be a problem with your Debian deciding that two seemingly identical (cat just identically copies the content from one file to the other, no modification of the content, just the creation date, the permissions and other non-important things will be different) files should be opened in two different ways. Can you share the faulty pdf? Commented Feb 6, 2019 at 10:21
  • I was about to share the file but I started experimenting; I had defined a 'theorem' for Remarks, and I named it rem; it was this that was causing trouble; I just renamed it and everything works fine! Apparently \rem is some sort of internal command for TeXstudio: sourceforge.net/p/texstudio/discussion/907839/thread/09d48286 Thanks for the interest! :) Commented Feb 6, 2019 at 17:48
  • This is weird... Maybe it's a TeXstudio bug or something like that. If you can provide a MWE with this behaviour it would be interesting. Just adding that newtheorem in a document of mine is not enough for reproducing the weird behaviour. Commented Feb 7, 2019 at 15:40
  • What version of TeXstudio do you use? Mine is 2.12.14 from the Debian testing repos. Commented Feb 7, 2019 at 18:17

Apparently the problem was an environment whose call word was rem (I used it to define a Remark 'theorem': \newtheorem{rem}{Remark}). I just renamed it and now running Build&View produces a true PDF file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .