How to Use LaTeX

LaTeX software is used to create short or long mathematical articles, consisting of paragraphs of text interspersed with mathematical equations and expressions. The equations and expressions may contain such things as definite integrals, indefinite integrals, square roots, fractions, summations, etc., all displayed in the standard way as in a math textbook. After you have downloaded and installed LaTeX software, you should use it through a command interface. With a windows operating system, activate what is called the "command prompt". This typically produces a window with a black background and with a prompt followed by a blinking cursor. In this window the user types in various commands. There is a default directory. Files created and saved will generally be saved in the default directory. When using the command prompt, the default directory may be changed by means of the cd command.

Now let us assume that LaTeX software has been successfully downloaded and installed. Typing a mathematical article in LaTeX (the whimsical term "tecking" is sometimes used) begins with using a bare-bones word processor such as Notepad to type the document as an ascii file. This file is allowed to contain letters, numerals, spaces, and punctuation symbols, and practically nothing else. That is what makes it an ascii file. An ascii file is allowed to contain hidden "end of line" symbols, the so-called CR-LF combination, but essentially no other hidden formatting symbols. Text material is typed as ordinary sentences and paragraphs. Mathematical notations are typed in special LaTeX code which is something for the new user to learn. The file that is produced in this step should have the extension ".txt" or ".tex". For example "myfile.txt" would be a good file name. We will call this file the LaTeX file. It is the LaTeX file that will be processed by the LaTeX software.

The LaTeX file must be free of almost all hidden formatting symbols. For this reason it should not be of type ".doc". The file may be created with Microsoft Word, provided it is saved with the extension ".txt". It is probably easier to use Notepad.

Now here is one specific way, using a windows software together with LaTeX software, to produce a nice pdf document containing mathematical symbols and expressions. Activate a command prompt. Choose a name for the LaTeX file, say 'myfile.txt', and at the command prompt type

notepad myfile.txt
You will then get a message saying the file does not exist and asking you if you want to create it. Respond yes. This will open up the Notepad window in which you can type. Type up the LaTeX file. Then save it. It should still have the name 'myfile.txt'. Now exit from Notepad and return to the command prompt. At the command prompt type the command
pdflatex myfile.txt

This will activate the LaTeX software. That software will parse the LaTeX file. If there are no error messages and the process goes through to completion, the process will produce a file called 'myfile.pdf', stored in the default directory. At the command prompt type

myfile.pdf
and the default software for reading pdf files will open the file myfile.pdf. That file should be the "beautiful document" corresponding to the LaTeX file 'myfile.txt'. If the software displaying the document is Adobe Acrobat, the file may be printed by clicking on the printer icon in the menu at the top of the Adobe window or by clicking on "File" and selecting "Print" from the pull down menu.

There is an alternate way to produce the printed document. Instead of the command "pdflatex" use the command "latex". For example type "latex myfile.txt". Instead of a pdf file this will produce a dvi file saved in the default directory. The name of the dvi file will be "myfile.dvi". Now type "yap myfile.dvi". The Yap program, if available, will seek a file by the name "myfile.dvi", find it, and display it. Again there is a printer icon that may be clicked. One advantage of the dvi format over the the pdf format is that for a given file the dvi format will occupy fewer bytes of computer memory. However, the pdf format has its advantages, too.

To review the process we have just described, we will list the several discrete steps that comprise the process on a computer with the Windows operating system.

  1. Activate the command prompt.
  2. Type the command
    notepad myfile.txt
  3. and press return. Respond yes if asked if you want to create the file. A notepad window should open on the screen.
  4. Type the file. The following format should work.
    \documentclass{article}
    \begin{document}
    [Place lines of text and expressions here.]
    \end{document}
  5. Save the LaTeX file, and exit Notepad, so that you are back to the command prompt.
  6. At the command prompt type
    pdflatex myfile.txt
    and press return.
  7. Suppose an error message appears. Then type an "x" and press return to get back the blinking cursor of the command prompt.
  8. At the command prompt type
    notepad myfile.txt
    and press return. This should open up your LaTeX file so that you can edit it and correct the mistake.
  9. When you have made all the needed corrections, save the file, exit from Notepad, and return to the command prompt window.
  10. At the prompt, type
    pdflatex myfile.txt
  11. and press return.
  12. This time, one hopes, the latex software completes its run without any error messages and you are back to the blinking cursor of the command prompt.
  13. In response to the command prompt type
    myfile.pdf
    and press return. This will cause Adobe Acrobat to open up and display your nicely compiled file for reading or printing.

The files below are examples of latex files and the pdf files they produce. There is lots of good documentation for LaTeX on the web. Find it by searching for LaTeX2e. LaTeX software may be downloaded through the Miktex website or the Latex Project website . The name of the actual software package is "Miktex." If the website offers a small version and a large version, choose the small version.