9

I just installed MiKTeX and TeXstudio, but when I try to compile a document I get the following error:

Error: One command expansion invalid.

Make sure that you have installed a (La)TeX distribution e.g. MiKTeX or TeX Live, and have set the correct paths to this distribution on the command configuration page.

A (La)TeX editor like TeXstudio cannot work without the (La)TeX commands provided by such a distribution.

I did some Googling, and found where I needed to go, and in options -> configure LaTex -> Commands -> LaTex, I have the following:

"E:\Program Files\MiKTeX 2.9\miktex\bin\x64\latex.exe" -src -interaction=nonstopmode %.tex

(the file path is correct, I double- and triple-checked) Can someone tell me what I'm doing wrong?

closed as unclear what you're asking by egreg, Przemysław Scherwentke, Mensch, Jesse, Zarko Dec 24 '15 at 17:15

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Can you compile from the command line? – Bernard May 22 '15 at 0:26
  • 1
    can you also try putting "%.tex" ? (I mean with the straight quotes like the latex.exe path. I'm wildly guessing by the way. – percusse May 22 '15 at 0:43
  • When I input pdflatex Libraries\Documents\ch1demo.tex into the command line, it returns the error "I can't find file pdflatex". – crlast86 May 22 '15 at 0:49
  • 1
    That actually helped me find the answer - I needed to give TeXstudio the filepath to pdflatex. Thank you! – crlast86 May 22 '15 at 0:52
4

I was getting the same error. Fixed for me by explicitly filling-in all the paths as shown... enter image description here and enter image description here

  • 1
    That should not be necessary. It is often a sign that the path variable have not been set up correctly – daleif Sep 5 '15 at 19:50
  • 2
    Please add to your answer that the path a dependend of the used system. So your solution must not be the right one for an other reader ... BTW: better would be to write the pathes, showing them in an images makes coppying not easier ... – Mensch Sep 5 '15 at 20:05
7

This is probably because the MiKTeX is installed in a different directory than the TeXstudio. For example, if you choose default settings, MikTex is under x64 folder while TeXstudio is under x86 folder.

The best way is to manually install them in the same directory otherwise you will have to set the configuration line by line. I fixed this by reinstalling TeXstudio and then it linked to MiKTeX on the first trial. Hope it helps

  • 1
    I just tried this and it worked. By default on windows, MiKTeX installs into AppData. Instead, install it in Program FIles (x86) and then reinstall TeXStudio. It then finds MiKTeX and auto configures everything. – Phlox Midas Jan 21 '16 at 10:02

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