Getting started with LaTeXAn exampleLearning the basics

Learning the basics

The first section of Leslie Lamport's book LaTeX is titled "How to avoid reading this book." There he suggests looking at two sample LaTeX input files and comparing them with the corresponding output. Your first LaTeX exercise is to examine these files, process them, and preview the output on the screen.

Proceed as follows. At the command prompt in a terminal window, type the command  latex small2e and press the Enter key. You should now see some messages something like the following (the dots represent some omitted lines).

This is TeX, Version 3.14159 (Web2C 7.3.1)
(/usr/share/texmf/tex/latex/base/small2e.tex
     . . . . . .
Transcript written on small2e.log.

(If instead you got a message like

This is TeX, Version 3.14159 (Web2c 7.0)
! I can't find file `small2e'.

then the LaTeX installation on your computer is likely incomplete or misconfigured, and you had better consult a wizard.)

The second line of the message shows the path on your computer to the LaTeX source file small2e.tex. Use this path information to load the file into your text editor. Read through the file small2e.tex to get a preliminary idea of what LaTeX code looks like.

Now execute the command xdvi small2e & in your terminal window. (That trailing ampersand tells Unix to run the command as a background process, so that your command prompt is still available for further commands.) A preview window should open that shows the processed LaTeX file as it will appear when printed. (The hard copy will look better than the screen image because the printer has higher resolution than the screen.)

Now compare the screen output with the input file. You should get a basic idea of how LaTeX works as a "markup language."

Next try the same procedure with the file  sample2e.tex. (Incidentally, the reason for the 2e in these file names is that the current version of LaTeX is named LaTeX2e. The previous version was mysteriously named LaTeX2.09, and the next version is going to be LaTeX3.)

How do you get hard copy of the LaTeX output? After you have successfully run latex, issue the command dvips small2e or dvips sample2e. This will produce a PostScript file named small2e.ps or sample2e.ps. This PostScript file is what you send to the printer to get hard copy on paper. (On some systems, dvips is configured to send the PostScript file to the printer automatically, without writing the file to disk.) On most Unix systems, the command to send a file to the printer is either lp filename or lpr filename (you need to include the extension .ps in the filename). If you want to print from the Texas A&M University Department of Mathematics Calclab system, you will need to use "xprint".

Exercise

Now that you have a general idea about how LaTeX handles ordinary text, write a short (one or two pages) autobiographical essay in LaTeX. Imagine, for example, that you are introducing yourself to a class. You might discuss your geographical origins, your educational background, your hobbies, how you got interested in mathematics, and so forth.

Do not try to include any equations in this first exercise, and do not try to do any fancy formatting. Remember, when you are writing, you should be thinking about the content, not the form. Do, however, pay attention to expressing yourself in an organized, grammatical fashion.


logo The Math 696 course pages were last modified April 5, 2005.
These pages are copyright © 1995-2005 by Harold P. Boas. All rights reserved.
 
Getting started with LaTeXAn exampleLearning the basics