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).
[Tex/LaTex] How to compile a LaTeX document
compilingwindows
Related Solutions
Requirements
The preliminary steps can be summarized as follows:
Note that for each installation, just accept the default settings.
- Install either TeX Live 2012 or MikTeX (the latest version).
- Install Adobe Reader.
- Install TeXnicCenter (RC1 is the stable one).
Configurations
Now configure the installed TeXnicCenter as follows:
Run the TeXnicCenter, you will be prompted to specify the path to TeX binary as follows.
Pressing the
Next
button, you will be prompted to find the TeX binary path. Press theBrowse
button to locate the path.For TeX Live the path is as follows,
If you installed MikTeX then the path will be different, please locate it by yourself.
Pressing the
Next
button will bring up the following window, just accept the default.Pressing the
Next
button again will bring up the following window, just click theFinish
button.
Override Output Profiles
If you installed Adobe Reader 10 (X in roman) then you need to modify the output profiles. Press Alt+F7
to bring up the Profiles
window, choose an item to modify (for example LaTeX => PDF
), select Viewer
tab. Your edit should look as follows,
Make a try
Create a new blank document by pressing the white icon right below the File
menu (I enclosed it with a red rectangle). Type the following dummy text, save it, make sure you choose LaTeX => PDF
item (I enclosed it with a red rectangle), then press CTRL+SHIFT+F5
.
And congratulation, you will get a PDF output as follows:
In principle you can switch from .eps
files to .pdf
without much ado, as long as there is no other direct PostScript
code in your document, e.g. pstricks
or psfrag
.
The formats of .pdf
and .eps
files are completely different and pdflatex
can handle inclusion of .jpg
, .png
, .gif
and .pdf
(recognized ones) files, but not .eps
or .ps
files.
In order to use such files in your .tex
document, those .eps
files has to be converted to .pdf
(or one of the recognized ones). This can be done
- either beforehand, using a direct converter of a graphics programe or
epstopdf
perl script (see http://www.ctan.org/pkg/epstopdf), ideally having a file namedfoo.eps
to become foo.pdf, so nothing has to be changed in*.tex
file, as long as no direct extension is given. This means direct inclusion after direct conversion. - or let
pdftex
orpdflatex
do the job by converting the graphics file while compilation. In this case the filefoo.eps
will be converted tofoo-eps-converted-to.pdf
, having really that longer name. There is the packageepstopdf
(not to be confused withepstopdf
perl script!), giving some options how the conversion is done etc. Automatic conversion requires theshell-enable
feature, i.e.pdflatex --shell-escape
. This is called on-the-fly-conversion
Regarding the aspects of including rotated pictures or (via sidewaysfigure
):
Some .eps
generators produce already rotated pictures, so they have to be either rotated again (to the other direction) or can be included correctly, depending on the particular application.
The package graphicx
allows for \DeclareGraphicsPath
and \DeclareGraphicsExtension
commands.
Generally said, it is better to omit the file extension in \includegraphics
, such that \includegraphics
can search a list of possible extensions and include the first match. If you rather prefer to include foo.jpg
instead of foo.pdf
, then say \includegraphics{foo.jpg}
explicitly.
Regarding such PostScript
specific code from psfrag
or pstricks
: In my personal point of view, it is better to generate a standalone .eps
file from that code with latex
in an other *.tex
document and include it in the current .tex
file, with one of two possibilities mentioned above. In this case pstricks
package pst-eps
might help, in conjunction with dvips -E -o
option.
\documentclass{article}%
\usepackage{graphicx}%
\usepackage{epstopdf}% Not necessary, actually, please see http://www.ctan.org/pkg/epstopdf-pkg
\begin{document}
\begin{figure}
\includegraphics{ctanlion.eps} % will not work always, since restricted to `.eps`
\includegraphics{ctanlion} % will work always, since file extensions will be added appropiately
\caption{CTAN lion drawing by Duane Bibby; thanks to www.ctan.org}
\end{figure}
\begin{figure}
\begin{tabular}{ll}
\begin{tabular}{l}
\includegraphics[scale=0.5,angle=0]{ctanlion}
\end{tabular} &
\begin{tabular}{l}
\includegraphics[scale=0.5,angle=-90]{ctanlion}
\end{tabular} \tabularnewline
\begin{tabular}{l}
\includegraphics[scale=0.5,angle=-270]{ctanlion}
\end{tabular} &
\begin{tabular}{l}
\includegraphics[scale=0.5,angle=-180]{ctanlion}
\end{tabular}
\end{tabular}
\caption{CTAN lion drawing by Duane Bibby; thanks to www.ctan.org}
\end{figure}
\end{document}
Best Answer
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.