46

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).

Juan A. Navarro
  • 62,139
  • 32
  • 140
  • 169
Amir Rachum
  • 4,333
  • 6
  • 30
  • 37
  • 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 '10 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. – Juan A. Navarro Aug 12 '10 at 12:03
  • is there a Apple/mac os solution? – Charlie Parker Aug 26 '17 at 19:39
  • @CharlieParker Yes, there are plenty. Lyx is available for mac as well. You should start by reading the following intro: https://computers.tutsplus.com/tutorials/the-beginners-guide-to-using-tex-in-os-x--mac-45177 – Tormod Mar 02 '18 at 06:26

3 Answers3

54

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.

CampanIgnis
  • 4,624
Tormod
  • 1,410
  • 7
    I'd upvote, except that you seem to be recommended importing into Lyx as a reasonable possibility, a path of pain for novices. – Charles Stewart Aug 12 '10 at 13:37
  • Is File > Import > LaTeX (plain) in Lyx broken? – Tormod Aug 13 '10 at 07: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. – Charles Stewart Aug 18 '10 at 10:11
  • is there a Apple/mac os solution? – Charlie Parker Aug 26 '17 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 '20 at 10:38
6

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.

0

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)` – Oleg Lobachev Jan 27 '20 at 22:55
  • Unless the poster accidentally alias pdflatex to latexmk for some reason, but that should not happen. – user202729 Dec 31 '21 at 03:17