130 likes | 443 Views
LaTeX Introduction. A CSUA Help Session. TeX History. Written by Donald Knuth, Professor of Computer Science at Stanford Knuth was writing The Art of Computer Programming , a classic CS text. Existing typesetting methods were not good enough. He created TeX in the late 1970s.
E N D
LaTeX Introduction A CSUA Help Session
TeX History • Written by Donald Knuth, Professor of Computer Science at Stanford • Knuth was writing The Art of Computer Programming, a classic CS text. • Existing typesetting methods were not good enough. • He created TeX in the late 1970s. • Also: METAFONT, a font description language.
TeX Was Too Low-level • TeX requires explicit invocation of font and layout commands to control appearance of text. • Instead of saying: \font\sec=cmbx20\sec\noindent, people wanted to say \section to start a section title. • You could define your own commands, though.
Enter LaTeX • LaTeX is a collection of defined commands. • There is a \section command to write a section title, for example. • Written by Leslie Lamport in 1985. • Provides many more features • e.g., the \section command provides for automatic numbering and table of contents generation if you want • Most recent version is LaTeX2e.
Classes and packages • These are LaTeX’s method for extending it. • Different documents have different classes (you’ll see this later; for example there are article and letter classes). • Packages allow you to call in extra features • E.g., there is a package for inserting figures into your document.
AMS-TeX • LaTeX was not the only set of extensions to TeX. • AMS-TeX was a collection of extensions to TeX with more advanced mathematical typesetting features. • Now LaTeX is by far the most popular. Most features from AMS-TeX have been absorbed.
Getting LaTeX • It is free. • It is on EECS instructional systems. • It is on CSUA and OCF systems. • It comes with all normal Linux distributions. • For Windows try http://www.miktex.org/.
Writing LaTeX • A sample document: \documentclass{article} \begin{document} Hello, world! \end{document}
What do you do with it? • You turn LaTeX files into DVI files, with this command: latex file.tex. • The file extension should be “tex”. • LaTeX will create a file called file.dvi.
DVI Files • DVI files are what TeX creates by default. • For display, type xdvi file.dvi at the prompt (in X). • On Windows, read the manual. • For printing, turn them into Postscript files with dvips file.dvi -o • Then print the Postscript file file.ps as you would any Postscript file. • If you omit the -o, dvips will have some default behavior which might be to print the file and might be to produce a ps file, depending on how it’s set up.
Creating PDF files • To create PDF files, type pdflatex file.tex • The program is basically the same as latex, except it produces a file.pdf PDF file.
Problems • Often LaTeX will fail with an error. • If it has a question mark for you, type “x” and press enter. • This will quit LaTeX. • When LaTeX dies like this, it is almost always because you screwed up.
How to solve problems • Look at the error LaTeX gave you. • It will have a line number which will help you find the error. • Common mistakes: • Mismatched \begin{}/\end{} blocks • Mismatched {/} • Mismatched $, $$, or \(\) or \[\] • Misspelled keywords • Sometimes lines are too long. This isn’t fatal but looks bad. LaTeX outputs a warning with a line number so you can fix it.