2

I have a .tex file in the following path

C:\Users\sepideh\Desktop\dissertation\formulasInLatex\eigenvector or eigenvalue decompositions.tex

with the following content:

\documentclass[a4paper]{article}
\usepackage{amsmath}
\begin{document}
    $
    T_3 = U_P\sum_P U_P^{-1}
    $
\end{document}  

when I press the button Build & View in TexStudio
enter image description here
I get the error:

Error: Could not start the command: pdflatex.exe -synctex=1 -interaction=nonstopmode "eigenvector or eigenvalue decompositions".tex

I also had another file in the same path:

C:\Users\sepideh\Desktop\dissertation\formulasInLatex\wave covariance matrix.tex

with a PDF file associated to it. That was built almost a year ago with an earlier version of TexStudio (Currently I'm using TeXstudio 2.11.2 with MikTex 2.9)

C:\Users\sepideh\Desktop\dissertation\formulasInLatex\wave covariance matrix.pdf

Meaning that I'm sure that the syntax of the second file is correct because it was compiled successfully in the past.
But when I deleted the PDF file to compile and build it again, I encounterd the same error:

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

Can anyone suggest me why the command pdflatex.exe couldn't start?

3
  • 4
    Are you sure that your TeX system is working and being found correctly? Can you start the Command Prompt and try pdflatex --version, and edit in the response you get.
    – Joseph Wright
    Commented Dec 13, 2016 at 14:40
  • 3
    Does TeXStudio know where to find pdflatex.exe? Look in its settings. Commented Dec 13, 2016 at 15:16
  • 1
    @PietvanOostrum Thanks, I had to manually set the paths to .exe files Commented Dec 13, 2016 at 18:04

2 Answers 2

5

In order to solve this problem, I did the following:
From the menus at the top:

Options > Configure TexStudio...

enter image description here
Choose Commands on the left

enter image description here

and then manually enter the paths to .exe files by clicking on the below icon (select program) next to each line and then press OK.

Thanks to the comments made by @JosephWright and @PietvanOostrum .

1

I use TeXStudio with TeXLive and it works fine. Yesterday I was installing Julia, Atom, Juno, Anaconda and many other things and I also changed some paths in the environment variable of my computer. This caused my TeXStudio shows an exactly similar error as in the question here and also the question in the post in this link (click here).

This is the error I got:

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

I tried one of the answers of the second link suggesting

TexStudio -> Options -> Restore default settings ...

But then I got a message saying there is no TeXLive or MiKTeX installed and advising me to install one before running tex files with TeXStudio. But I already had TeXLive and used it until two days ago so it couldn't be the real problem. Fortunately I guessed that probably the problem is because of the environment variables etc and the program can't find the path to pdftex etc of the TeXLive. Then here is what I did and TeXStudio worked fine after it.

right click on my computer icon on the desktop -> choose advanced system settings ->
choose the advanced tab -> choose the environment variables -> 
in the system variables find Path and double click on it -> click on New ->
copy-paste the address of the folder where your pdftex.exe etc are located there for example
in my case it was "C:\texlive\2019\bin\win32" -> click ok.

You must log in to answer this question.

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