Running LaTeX
Okay, now we have some LaTeX input consisting of ASCII text and formatting
macros. The next task is to actually invoke LaTeX and have it generate output
from our ASCII input. To do this we place our input in a wrapper file, denoted
with the extension .tex. I have arbitrarily decided to call our LaTeX input file
test.tex and it looks like the following:
![](images/latex/runninglatexfigone.GIF)
For future reference, the text prior to the \begin{document} line is called
the preamble of the LaTeX input and the text between the \begin{document} and \end{document}
lines is called the body of the LaTeX input.
It is then necessary to compile this input code by invoking LaTeX. It is
possible to do this from a DOS window after witching to the directory in which
file test.tex is stored. Once you're in the right directory in the DOS window,
type
latex test
(Note that you are not required to type the .tex extension of input file
test.tex, because LaTeX expects to see it there. You can type it anyway, if you
like.)
I usually do not bring up a DOS window, instead running LaTeX from inside PFE:
click on the Execute menu item and select DOS Command to Window... F11. A
dialog box will appear:
![](images/latex/runninglatexfigtwo.GIF)
Click on the ... button immediately to the right of the Command text
window in which I've typed "latex test" (it has the focus in the
picture above) to choose the correct directory (where the input file is
located). You'll see a lot of LaTeX diagnostic messages scroll by in a DOS
window as a result of your command. When the process is finished, the DOS box
will disappear and a new window will open in PFE which should look something
like this:
![](images/latex/runninglatexfigthree.GIF)
Near the bottom of the output, notice that a "device independent"
file called test.dvi was written and is the output of LaTeX using file test.tex
as the input. The dvi file can be read directly by a dvi view (e.g., "Yet
another previewer" YAP), or it can be translated into another format, say
postscript, using dvips.
For now, let's view it directly using YAP. Open the YAP application (it came
with the MikTeX distribution). Under the File menu, chose Open...
and choose the test.dvi file. Click the Open button and you should see the image
shown below:
![](images/latex/runninglatexfigfour.GIF)
To print, choose the File menu again and select Print...