1

Recently I started facing a problem while compiling my TeX files, not all of them, but some files which may be larger a bit from others. I get this error

Error: Could not start the command: pdflatex.exe -synctex=1 -interaction=nonstopmode "main".tex

Can anyone help understand what's the problem?

  • 1
    Welcome to TeX.SE... What type of TeX you are using, e.g., PDFLaTeX, XeLaTeX, etc? – MadyYuvi Feb 14 at 11:06
  • 1
    Exactly what kind of system are you on? Which editor are you using. Usually this message means that your editor (sounds like texmaker or texstudio) cannot find pdflatex on your system. But we need more information in order to give more help. – daleif Feb 14 at 11:30
  • 6
    that's not a tex error that is the standard windows error from an unknown command, so windows can not find a command called pdftex so either it is not installed or your path is wrong, so windows can not find it. It is not related to the document as that has not been opened at all. – David Carlisle Feb 14 at 11:32
1

Hi @khawla and welcome to TeX-SE.

I'm assuming your are on Windows and using TeXstudio, much likely because I've got the same errors long time ago and the -synctex=1 is a default setup. And you are using pdflatex since it is written on the error message.

In TeXstudio, go to Options -> Configure TeXstudio and then to Commands at the left menu. Check the syntax there. Note that %.tex is replaced by the name of your file.

enter image description here

You may try to use the path to pdflatex.exe directly setting it. If you have problems to compile with the default syntax, then probably there is some error with your paths. In a standard installation in Windows 10, MikTeX will save pdflatex.exe at AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64, which you can access through typing %appdata% at the path bar. In others operational systems, check the correct path. If you installed MikTeX in another non-default folder, then please search for it.

enter image description here

Then you give the explicit path using quotes. You may remove the options -synctex=1 and -interaction=nonstopmode if you will.

enter image description here

Any given command inserted at the menu Commands has the same effect as typing it directly into the command prompt (DOS in Windows), which can be accessed by typing cmd in the path bar.

enter image description here

If none of this wirk for you, then I stil may suggest to reinstall MikTeX, letting it to install in its default path, and if it still do not work, then reinstall TexStudio.

If you use Linux, then I'm sorry not knowing the details at the same level. But someone in the forum will certainly know if you tell us you are on Linux.

  • This worked out the problem, perfect, thanks. – khawla Feb 18 at 9:23
  • You are welcome @khawla. Now you know the workaround and that it works. When you have some time, try to reinstall TeXstudio after MikTeX installation. I had this issue twice in the past when MikTeX changed how/where it installs itself. It is the best idea to use absolute paths. For example, if you must compile with other method, you gonna repeat the whole process of finding and editing. – FHZ Feb 18 at 13:00

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