After installing MiKTeX and TexMaker, I tried using TexMaker to create a simple first script. When I tried to compile it using PdfLaTeX, I got an error message saying:

Could not start the command. pdflatex -synctex=1 -interaction=nonstopmode %.tex

When looking on StackExchange for a solution, I stumbled upon the solution of indicating the path to the pdflatex.exe file in the configurations of Texmaker. It was indicated this file would be at C:\Program Files\MiKTeX 2.9\miktex\bin\x64. But there was no such file. The best I could find was miktex-pdftex.exe. I tried inputing

"C:\Program Files\MiKTeX 2.9\miktex\bin\x64\miktex-pdftex.exe" -synctex=1 -interaction=nonstopmode %.tex

in the PdfLaTeX field instead, which resulted in the same error.

Could a problem be that I tried rerunning the MikTeX installer before looking the problem up (and changed the installation from single user to all users)?

  • 1
    Try to create the wrappers (like pdflatex.exe) with initexmf --admin --mklinks (in a command line with admin rights). But if you have a mix of admin/user miktex installation it is very difficult to say if initexmf will actually use the correct folders and binaries. – Ulrike Fischer Mar 23 at 13:42
  • @UlrikeFischer would you therefore recomend I uninstall miktex, and reinstall it as shared/admin only? – Thomas Bezençon Mar 23 at 14:04
  • 1
    Sorry the state of your system is so unclear that I won't recommend anything (but I install miktex always only for me in my user account to avoid to have to maintain both the user and the admin tree). – Ulrike Fischer Mar 23 at 14:06
  • Probably just a pathing issue If you run MiKTeX-console settings it will try to correct a bad path anyway from the terminal (black box on the left inside MiKTeX console you can try to run pdfLaTeX -v it it reports 'pdflatex' is not recognized as an internal or external command, operable program or batch file. then it did not fix the path issue – KJO Mar 23 at 14:10

As stated in the question, I installed MikTeX as single user, and then again as all users.

But the all users instalation failed due to the presence of the single user version, and the path the path C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe only works for the all users version. After uninstalling MikTeX and only installing it as single user, I was then able to find the correct path for my single user installment under C:\Users\Thomas\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe. This path now works.

  • great but ensure you are not constantly having to change each entry the second installation should have reset the defaults so if one is wrong all are wrong and will likely keep tripping. ENSURE MiKTeX-console is happy with the paths such that just typing one word luatex at a terminal will work the same as latex or pdfLaTeX or bibtex or …... – KJO Mar 23 at 15:53

The control room for a MiKTeX installation is MiKTeX-console it can install and update TeX packages and components but does much more.

If you can't run latex out of the box it is usually a PATH issue and the console can SOMETIMES assist in fixing that, however it may not always succeed, but at least you know what is wrong.

What you should be seeing in your case within the console is now C:\Users\Thomas\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64 and if you have a red box around that saying PATH issue you need to fix it

enter image description here

That black box in the lower left of console is useful to shell out to windows terminal and see the current settings so by type and enter path we can see that the MiKTeX entry has an extra \ at the end which caused the error condition.

If you need to change the path yourself there are several guides one that shows locations from XP through 7 & 8 to Win 10 is at https://www.opentechguides.com/how-to/article/windows-10/113/windows-10-set-path.html

Once it is corrected we can restart the computer and check the setting again.

IF there is no longer a PATH issue and using the terminal window we get a response from entering> pdfLaTeX -v (showing version 2.9.7000 or later) all is well

if pdfLaTeX -v still responds not found then try

where /r c:\ pdflatex 

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.