LaTeX

ShscWiki :: LogIn :: PageIndex :: RecentChanges

Beginner's Guide to LaTeX

This guide is meant to get you started using TeX and LaTeX.  It is not meant as an exhaustive tutorial, but feel free to add some info if you notice anything is missing.
 Table of content 


What is LaTeX?


TeX and LaTeX have been around since the mid 1970's for use as a document preparation tool before the existence of GUI text editors.  LaTeX, the most popular derivation of the TeX typesetting language is still used today for a variety of applications including, but not limited to: books, journal/conference publications, and even homework.

On a more technical level LaTeX is a markup language like HTML. The text file containing the content and markup is compiled by a LaTeX distribution into a variety of formats such as PostScript, PDF, and HTML.

Why Should I Use LaTeX?

LaTeX is a system designed to make producing beautiful, consistent documents easy. It will automatically handle numbering section and subsections, inserting page numbers for references, building a table of contents and a properly formatted bibliography. It also allows for relatively easy typesetting of mathematical formulas. LaTeX makes short documents look great, and it makes writing long documents easy. Also, because the source files are all plain text, they can be stored in a revision control system such as CVS or Subversion, making collaboration for group documents much easier.

Where Can I Get LaTeX?

To use LaTeX you will need a distribution for your Operating System to compile the TeX files. It is also convenient to use an editor which understands TeX, but any text editor will do.

Most open-source operating systems provide teTeX through their respective package management systems. teTeX is being replaced by TeX Live, so your system may use either name for the package. For Windows, try MiKTeX.

LaTeX Editors

For editing on Windows TeXnicCenter is recommended.

LyX is a visual editor, what you see in the editor is what you should get from the output. It's available for UNIX, with ports for Windows and OSX.

Other options for OSX include TeXShop and TextMate.

A Sample LaTeX Document

\documentclass{article} \begin{document} \title{My Article Title} \author{Some guy} \date{\today} \maketitle \section{Some section} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec mi. Etiam tincidunt rhoncus diam. Morbi in nibh. Pellentesque gravida. Integer at arcu eu erat sollicitudin ultricies. Sed imperdiet dolor at metus. Vestibulum dolor. Aliquam semper tellus. Phasellus metus. Pellentesque at quam pharetra nulla suscipit pellentesque. Donec elementum vehicula sapien. Nam diam urna, mollis quis, sollicitudin vitae, faucibus ac, lorem. Cras rutrum, nunc vitae molestie sodales, arcu leo ullamcorper augue, ac semper magna felis mattis leo. Integer pellentesque. Suspendisse potenti. Integer lacinia lobortis neque. Mauris sodales. Cras sem. Sed sagittis, felis in fermentum fermentum, pede lorem consequat ante, eu molestie eros neque lacinia ante. Praesent iaculis pede sit amet ipsum. Mauris dapibus. Curabitur ligula ligula, fermentum in, condimentum non, adipiscing quis, mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer condimentum augue vel velit. Quisque auctor aliquam metus. Sed tortor libero, placerat eu, varius in, pulvinar ac, lectus. In venenatis justo a odio. Donec facilisis tellus ac elit. Fusce blandit, nunc ac laoreet lobortis, urna elit lacinia nunc, non pretium metus nisl at lacus. Fusce cursus pede. Aenean suscipit pede id orci. Sed felis quam, pharetra et, egestas quis, vehicula sed, purus. Curabitur lacus. Nam erat tortor, ultricies sed, consectetuer sed, aliquam a, nunc. Fusce pellentesque faucibus erat. \subsection{A subsection} Suspendisse ut erat vel ipsum sodales congue. Cras erat. Morbi vehicula sagittis felis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Mauris aliquet, elit a dapibus pulvinar, sapien leo mattis augue, eget egestas magna nibh in nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Phasellus aliquam augue at mauris. Vestibulum mollis orci et justo. Suspendisse purus. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras faucibus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque sem massa, pharetra non, lacinia in, consectetuer et, nisl. Sed vehicula. Pellentesque in eros. \subsubsection{A subsubsection} Praesent convallis. Etiam ac urna a odio rutrum sagittis. Fusce dui. Curabitur consectetuer convallis mi. Quisque et leo. Nulla facilisi. Ut eget mauris. Morbi faucibus elementum magna. Ut eget elit. Morbi tincidunt vehicula nisl. Nulla tincidunt cursus urna. Etiam a ante. Sed ipsum sapien, pharetra vel, iaculis sit amet, faucibus sit amet, mauris. Sed vel quam nec turpis tempor adipiscing. Phasellus risus neque, dapibus vel, viverra fermentum, malesuada quis, nisi. \section{Another section} Curabitur dolor turpis, fermentum nec, tincidunt a, tempor vitae, libero. Maecenas vitae sem. In hac habitasse platea dictumst. Phasellus non nunc id arcu tempus mattis. Nulla laoreet pulvinar lorem. Fusce tincidunt, neque sit amet feugiat dapibus, ipsum sem dignissim eros, a semper magna lectus a leo. Aliquam ac pede ut est pharetra molestie. Ut rutrum malesuada turpis. Proin ornare varius justo. Ut id mi a felis varius accumsan. Aliquam erat volutpat. Donec dignissim lacus in turpis. Aliquam lectus lorem, nonummy ac, interdum nec, condimentum nec, justo. Fusce vulputate, tellus ut varius congue, libero nulla bibendum nibh, non semper sem dolor ut libero. \end{document}


Setting Up Your Document



The "Preamble"


Inserting Figures Into Your Document


Inserting Tables Into Your Document


List of Common Commands


List of Mathematical Symbols


Printing Your Documents



Compiling Your .tex File

Running the latex command on your .tex input file (without the extension) will create a DVI (Device Independent) file. This file can be viewed by special viewers or converted to other formats such as PS or PDF. Running the latex command multiple times may be necessary if your are using advanced features such as references, table of contents, or bibliography.

Creating a PostScript Document

Once you have created a DVI file it can be converted to a PS file with the dvips command.

Creating a PDF

DVI files can also be converted to PDF with the dvipdf command, or you can go straight from TeX to PDF with the pdflatex command.

Miscellaneous Tips



Helpful Links


Realizing that this tour of LaTeX is far from complete, I've listed some of the links that I used to learn the language.

Official Sites

The LaTeX Project Homepage - A recommended reading if you are new to LaTeX.
CTAN - The Comprehensive TeX Archive Network - CTAN is a repository for all (La)TeX-related material, especially packages.

Other Tutorials

Getting Started with LaTeX - By: David R. Wilkins of Trinity University in Dublin.
Getting to Grips with LaTeX - By: Andrew Roberts of The University of Leeds, UK.
LaTeX Tutorial - By: Paul Oh of Drexel University, PA.
The Not So Short Introduction to LaTeX2ε - By: Tobias Oetiker of the Swiss Federal Institute of Technology in Zurich. (PDF alert)
Detailed LaTeX Overview -  Stanford School of Earth Sciences

Symbol Lists

Mathematical Symbols - A list of commands that can be used to generate symbols in math ($) mode.
Derivatives, Limits, Sums, and Integerals - How to set up these kinds of symbols (not included in the above link).

Useful Packages

Beamer class - Technically, Beamer is not an extension but a document class. It is used to create beautiful slides presentations in PDF. There is a native 'slides' class in LateX, but this one is more powerful and can generate much more sophisticated presentations.
CJK - CJK allows the use of Chinese/Japanese/Korean characters in LaTeX.

Misc. Links

Producing White Space in LaTeX - I spent a lot of time trying to figure out how to make empty space in LaTeX, until I ran across this page.
TeX and the Japanese language - Everything you need to know if you want to write in japanese with LaTeX.
A LaTeX Resume class - A document class to write your resume with LaTeX.
MetaPost - A powerful graphics language based on Knuth's METAFONT, but with PostScript output. Good for creating figures with code.

This article is ©2008 by the respective authors. Reproduction is prohibited without express permission from all contributors.