SWARTHMORE CS 63 - A Brief Introduction to LATEX

Unformatted text preview:

A Brief Introduction to LATEXEric EatonFebruary 2, 2005LATEX is a text processing system that uses an embedded command languagein plain text to generate a formatted document. LATEX has excellent supportfor mathematical formulas and references, and is usually easy to use for peoplewho are comfortable with programming languages. LATEX is not a WYSIWYG(“What You See Is What You Get”) word processor. However, it is (in my opin-ion) much more powerful and flexible than most WYSIWYG systems, includingMicrosoft Word.1 Running LaTeXLATEX runs (at least) on the gl linux machines and should run on the cs machines.The easiest way to create a LATEX file is to use emacs (you may use any othertext editor, but emacs is very LATEX friendly). There is a very simple sample fileon the class website, in the file sample.tex. Here’s how you produce a typesetdocument from this file (after copying it into your own directory).% latex sample% xdvi sample% dvips -P pdf -G0 -t letter -o sample.ps sample.dvi% ghostview sample.psThe command latex processes the input .tex file, producing an output.dvi file. You can view this file on your screen using xdvi. If it looks the wayyou want it to, you can convert it to a PostScript file using the dvips command,with the switches shown in the script above. Now take a lo ok at the PostScriptfile using ghostview. You may also convert a .ps file to an Adobe Acrobat file(.pdf) by:% ps2pdf sample.ps sample.pdfIf the document (either .ps or .pdf) lo oks the way you want it, you mayprint it out using the respective viewer or simply use lpr on the .ps file.% lpr sample.eps1A more rapid way of obtaining a .pdf document is to use pdflatex asfollows:% pdflatex sample.tex2 Example FilesHere’s what the sample.tex file looks like:\documentclass{article}\title{Title of My Document}\author{My Name Goes Here}\begin{document}\maketitleHello, world!{\em Hello, world!}{\bf Hello, world!!}{\tiny \bf Hello, world!!!}{\Large \bf Hello, world!!!!}\end{document}The \documentclass{article} command on the first line of the file tellsLATEX that this is in fact a LATEX document, of class “article.” (There are otherdocument classes, such as report and book, but typically you’ll use the articleclass.)The lines after the \documentclass com mand and before the beginning ofthe document are called the preamble. The preamble includes any initializationcommands and general specifications for the document style. In this file, thepreamble just contains the title and author commands, on the next two lines.You can also specify, in the preamble, the date you want to appear on the doc-ument, using the command \date{Your Preferred Date}, or leave the dateblank using \date{}; if no date is specified, LATEX will use today’s date. To notinclude a date, you can use the command \nodate.Now the body of the document starts; this is signaled to LATEX by the\begin{document} command. The first command within the document bodyis \maketitle, which uses the title and author defined in the preamble to createa title section in the output file.After the title is the rest of the document: in this case, five paragraphs(which are delineated by blank lines), each greeting the world in a different style:2normal, emphasized (i.e., italic), boldface, small boldface, and large boldface.Note that the font-changing commands and text to be changed are enclosed incurly braces {}; these delineate the scope of the font-changing commands.The last line of the file, \end{document}, tells LATEX that the body of thedocument is complete.That’s it!All exams for this course are formatted in LATEX˙Along with the first assign-ment, the ex1.tex source, which contains solutions to the e xamples discussedin the first lecture, will be available for download. You may use this templatefor formatting your homework assignments or create any template you wouldlike.Strictly speaking, you are not required to format your homework solutionsin LATEX (although you are required for the first several homeworks), but as faras I can tell, LATEX is the best available system for generating mathematical andtechnical do cuments. If you cannot tell by now, I highly recommend using LATEXfor CMSC 203 and future mathematically oriented courses (e.g., CMSC 441,CMSC 471). You are required to typeset your problem set solutions,so if you choose not to use LATEX you assume all responsibility forpoorly formatted mathematical notation that may be subject to gradereductions. Your solutions must be typeset, printed on 8.5 × 11 white paper,and turned in in hard copy format at the beginning of class on their due date.This file (that is, the one you’re reading now) is also on the website, inlatex.tex.3 ResourcesThe standard LATEX reference book is LATEX: A Document Preparation S ystem,2/e, Leslie Lamport, Addison-Wesley, 1994, ISBN 0-201-52983-1.Here are several useful websites. I will post these on the course resourcepage.• LATEX Project home page:http://www.latex-project.org/– LATEX Project FAQ:http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes• CTAN: the Comprehensive TeX Archive Network:http://www.ctan.org/• Peter Flynn’s “Beginner’s LATEX” guide to basic LATEX:http://www.silmaril.ie/downloads/documents/beginlatex.pdf• The AMS maintains several widely used extensions of LaTeX. The amsmathpart provides just about every math symbol you can imagine, and more:http://www.ams.org/tex/amslatex.html3• “Simplified LATEX,” a beginner’s guide with a nice tutorial section at thebeginning:http://www.ctan.org/tex-archive/info/simplified-latex/• In order to run LATEX on your own computer, you will need to installTeX and LATEX. I haven’t tried to download it, but a number of freewareand shareware implementations are available. You can look through theCTAN or LATEX Project websites above for pointers. If you’re runningWindows, you might want to try this TeX/LATEX impleme ntation, w hichlooks promising: http://www.miktex.org/ .4 AcknowledgementsThanks to Marie desJardins and Matt Gaston for sharing course material andLATEX templates. This document is due in large part to Dr.


View Full Document

SWARTHMORE CS 63 - A Brief Introduction to LATEX

Download A Brief Introduction to LATEX
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view A Brief Introduction to LATEX and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view A Brief Introduction to LATEX 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?