Friday, September 16, 2011

YAP cannot find the path specified when using TexStudio

This week I started to use TexStudio, formerly knowns as TexMakerX, on my laptop. When I press 'F3' to view the dvi file, the following error occurs:
Windows API error 3: The system cannot find the path specified.
It also gives you the file path it cannot find in the same window.

The strange thing is, the file is in the given path. However, the YAP cannot find it. My system is 64-bit Windows 7, maybe it has something to do with they system? Googled a bit, nothing useful. Then I switched to TeXnicCenter, guess what, it is working perfectly. Thus there should be something wrong with the TexStudio configuration.

Looked at the TexStudio log windows, it shows
Process started: "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\yap.exe" -1 -s 14F:\folder x\math.tex "F:\folder x\math.dvi"
And in the configuration, it is the default value except the yap path.
"C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\yap.exe" -1 -s @?c:ame "?am.dvi"

After checked it carefully, I realised that the space in the path may cause the problem: the math.tex file in the log window doesn't have a "" to enclose the path. So here comes the solution. Change the dvi viewer command into one of the following in the configuration:

  1. "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\yap.exe" -1 -s @?c:ame" "?am.dvi"
  2. "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\yap.exe" -1 -s @%.tex %.dvi

Replace the yap path based on your system. Either of the approaches above has been tested and works well.


  1. Hey man! I have the same problem and I'm completely new to Latex. Where can you change the dvi viewer command? In the "Configure TexmakerX"?

  2. Yes, "commands" section.

  3. I had the same problem. Your solution worked like a charm. Thanks so much

  4. I had the same problem and your solution worked. Thank you so much.