# Unable to compile TeXmaker 4.0.2 with MiKTeX 2.9

I just downloaded first MiKTex 2.9 and then TeXmaker 4.0.2. However, I am having a hard time getting it to compile. I always get the info box saying `Can't detect the file name` followed by the info box saying `Could not start the command`.

In the `Configure Texmaker` -> `Commands` options box I have set the path in the bottom to:

"C:/Program Files (x86)/MiKTeX 2.9/miktex/bin"

I have also tried putting this file path in the specific command paths above (together with the filenames). But neither helps. I have been looking around at this and other Tex pages, and other people have asked the same question. I have tried to do, what they were advised to do, but is has not help.

I hope that somebody can help me.

-
Welcome to TeX.SX! You may have a look on our starter guide –  texenthusiast May 9 '13 at 13:33
Have you done Verify a latex installation: Commandline/Terminal to see output.pdf –  texenthusiast May 9 '13 at 13:39
for pdflatex in TeXmaker see if you have `pdflatex -synctex=1 -interaction=nonstopmode %.tex` in pdflatex command box. You might need to restart the windows to take the miktex bin path into effect –  texenthusiast May 9 '13 at 13:45
Okay, now I got it to compile - unlike TeXworks, Texmaker does not force you to save when you are compiling, but instead comes up with the above mentioned message... –  Marcus May 9 '13 at 19:13
@Marcus `pdflatex` or `latex` engine needs `filename.tex` file which is created by TeXmaker only when you save it with filename. there is no need to touch the "Add to PATH" commmand line in TeXmaker. Once MiKTeX is installed and Computer is restarted you will get miktex bin path automatically added to system PATH. So the default configuration works. Incase you need add `pdflatex -synctex=1 -interaction=nonstopmode %.tex` to `pdflatex` and `latex -interaction=nonstopmode %.tex` for `latex` in TeXmaker configure command box –  texenthusiast May 9 '13 at 19:28

Common newbie mistakes/errors Using TeXmaker

1. From Version 4.1 onwards, `A document must be saved with an extension (and without spaces or accents in the name) before being used by a command` pops out when the file is compiled (Press QuickBuild) before saving it as `file-name.tex`.

• Save the file as `file-name.tex` and then compile using `QuickBuild` or `PDFLATEX`.

2.`cannot detect file-name` and `Could not start the command` errors:

• In TeXmaker one needs to save `.tex` code as `file-name.tex` before compiling otherwise above errors pop out. In TeXworks, it's better handled by suggesting the `untitled-1.tex` file name before compiling.

• when compiling a `.tex` document in TeXmaker without installing LaTeX distribution MiKTeX/TeXLive/MacTeX etc. Since TeXmaker is just like any LaTeX editor needs LaTeX distribution to compile `.tex` and output `.pdf`

• "Note : a LaTeX distribution must be installed on the system to use TeXmaker" at TeXmaker Download page .

• Verify a latex installation: Commandline/Terminal after installation and In MiKTeX, after installation,Computer needs a restart to get miktex bin path added to system PATH automatically.

2. "File not found" error: TexMaker - "File not found" when viewing as pdf. when the `file-name.pdf` is not available/generated from `file-name.tex` during compilation due to following reasons:solutions

• Wrong output file path :uncheck "build" subdirectory in Configure window

• Lack of read/write output folder permissions : copy `file-name.tex` to another folder and compile

• renamed `file-name.pdf` : `file-name.tex` and `file-name.pdf` names should be same

• Missing `file-name.pdf` : Incase of `latex` compilation only `-file-name.dvi` is only available, one may need `dvips` and `ps2pdf` to get `compiled-file.pdf`

• `file-name.pdf` locked by another pdf-viewer : Close the external pdf-viewer

• Unable to generate `file-name.pdf`: Delete improper `.aux` files and why to Delete .aux file in order to successfully compile

• Common newbie errors Unable to generate pdf encountered in TeXniccenter are are applicable to TeXmaker as well.

1. Finally configure TeXmaker whenever necessary as defaults work fine.

• Typical command line arguments to place in the configure TeXmaker window :adding flag `-synctex=1` to enable synctex and `-shell-escape` to run external programs(when neccessary)

• `pdflatex -synctex=1 -interaction=nonstopmode %.tex`

• `latex -interaction=nonstopmode %.tex`

• `xelatex -synctex=1 -interaction=nonstopmode %.tex`