Up until now, I've just been using LyX for all my LaTeX needs. Now I have a .tex file and I need to compile it (turn to pdf). How do I do this on Windows XP? Obviously I have LaTeX installed (MikTeX).

  • 1
    The easiest way is probably to use an editor that integrates with TeX, like TeXworks. However, as I haven't compiled any TeX file on Windows for years, I leave this question for someone else to answer in detail.
    – Caramdir
    Aug 12, 2010 at 11:58
  • Amir, you seem to be a bit confused about the difference between TeX and LaTeX. I've edited your question to make it more accurate, but please have a look at this other question that explains the difference more clearly. Unless, of course, your file is really a TeX document, then please make that clear in your question. Aug 12, 2010 at 12:03
  • is there a Apple/mac os solution? Aug 26, 2017 at 19:39
  • @CharlieParker Yes, there are plenty. Lyx is available for mac as well. You should start by reading the following intro: computers.tutsplus.com/tutorials/…
    – Tormod
    Mar 2, 2018 at 6:26

3 Answers 3


one way of doing this is using the command line by entering pdflatex yourfilename.tex (assuming MikTex is in your path - just give it a try).

Another way would include installing software such as TeXnicCenter or TeXworks which will let you open/edit/compile a .tex file from within an editor environment.

A third way could be to import it into LyX and then compile with LyX as usual.

Edit: See LaTeX Editors/IDEs.

  • 7
    I'd upvote, except that you seem to be recommended importing into Lyx as a reasonable possibility, a path of pain for novices. Aug 12, 2010 at 13:37
  • Is File > Import > LaTeX (plain) in Lyx broken?
    – Tormod
    Aug 13, 2010 at 7:30
  • 1
    @Tormad: Lyx has to compile the Latex, and this process might fail since Lyx has to infer Latex's structure - Lyx only promises to compile what it calls "clean" Latex, and put what it can't parse into Tex tags. This is the right thing to do, but I wouldn't recommend it to beginners. BTW, if you want to draw a user's attention to your comment, put @WWW in your comment, where WWW is at least the first three letters of their screen name. Aug 18, 2010 at 10:11
  • is there a Apple/mac os solution? Aug 26, 2017 at 19:40
  • A middle complex LaTeX will be imported basically as unusable garbage in LyX. While LyX to LaTeX always works nicely, even import a file just produced by LyX could be a pain.
    – Fran
    Jan 28, 2020 at 10:38

I'd take a more integrated approach than the other answer.

Use build tools

Look on your system (some other sx site might be more appropriate, but, generally: Win-R – cmd – enter the commands and look for output) for either:

  • latexmk
  • arara.

Both let you automatize your LaTeX processing, in somewhat different ways. Basically, if you are able to run latexmk, you say latexmk -pdf yourdocument.tex (or even without file extension). The required number of pdflatex runs, the accompanying bibtex / biber runs, creating the glossary, all happens automatically.

If you don't have those installed, the typical routine is

  • latex
  • bibtex
  • latex
  • latex.

Only then you have a document with all the references and all the links.


Right now the command pdflatex w/o any keys doesn't work for me properly. I mean, it works, but not generated .pdf files as well.

So, the one-line solution is already exist!

pdflatex -pdf yourname.tex
  • 2
    Really, pdflatex -pdf? Not latexmk -pdf? $ pdflatex -pdf pdflatex: unrecognized option -pdf' This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex)` Jan 27, 2020 at 22:55
  • Unless the poster accidentally alias pdflatex to latexmk for some reason, but that should not happen.
    – user202729
    Dec 31, 2021 at 3:17

You must log in to answer this question.

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