LaTeX

From AIMSWiki

Table of contents

Introduction

LaTeX (http://www.latex-project.org/) is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation. LaTeX is the de facto standard for the communication and publication of scientific documents.

LaTeX is really a macro package on top of plain TeX (http://en.wikipedia.org/wiki/TeX), a typesetting system written by Donald Knuth. An alternative macro package, ConTeXt (http://en.wikipedia.org/wiki/ConTeXt), claims better design, more user control, and less package clashes, but the use of LaTeX is by far more widespread.

LaTeX is not a word processor! Instead, LaTeX encourages authors not to worry too much about the appearance of their documents but to concentrate on getting the right content. Read more at the LaTeX introduction (http://www.latex-project.org/intro.html).

Installation

LaTeX is packaged in Ubuntu under tetex, now unmaintained upstream, buy we still use this due to the slow migration of all associated packages and frontends to the new system, texlive. We use a frontend called kile (http://kile.sourceforge.net/). Kile gives you easy graphical access to almost all LaTeX functionality while showing you the source code and so teaching you at the same time. An faster, smaller, alternative being considered is texmaker (http://www.xm1math.net/texmaker/). See Fat_Diskless_Image_Customizations#LaTeX.2C_Report_Writing.2C_Image_Editing.2C_Web_Editing.

Documentation

At AIMS there are many LaTeX books in the computer lab and some useful documents and tutorials in the directory

/srv/local/Documentation/LaTeX/

and on the web there are many tutorials (http://www.google.com/search?q=latex+tutorial), but most are terrible. We are developing an AIMS specific Tutorials and FAQ LaTeXTutorialsandFAQ. However these two important references are indispensable for advanced users:

If you are getting started read the rest of this page and then continue to the LaTeXTutorials and LaTeXFAQ.

A simplified look at LaTeX files and formats

You can generate DVI, PDF or Postscript (PS) from TeX source files. Due to our heavy use of Encapsulated Postscript (EPS) figures at AIMS, we set up Kile to generate a Postscript file to include EPS graphics, and then to convert to PDF (which avoids the tedious process of explaining to technophobes how to install Free postscript viewers (http://pages.cs.wisc.edu/~ghost/gsview/)).

One writes code in a TeX source myfile.tex which look like this:

% Lines starting with '%' are ignored, they are for your own comments
\documentclass{article}
% Everything between documentclass and begin{document} is called the preamble
\begin{document}
Hello \LaTeX. Take note of the two most important concepts.
Commands are escaped with a backslash, and mathematics is a separate mode from text,
for example this equation: $\sum_{i=1}^n i = \frac{n(n_1)}{2}$.
\end{document}

You run the LaTeX command to produce a DVI file (myfile.dvi) which can be viewed with an application like evince. However, we continue to use the odvips command which produces a Postscript file (myfile.ps) in which you perhaps included EPS diagrams or figures. Lastly we use pstopdf to convert to myfile.pdf. There are other options, such as directly generating PDF from LaTeX. One has to keep this in mind when considering different graphics formats which you want to include.

Configuration of Kile

We set up kile to run all the necessary commands when you click the Quickbuild button, or use the alt-1 keyboard shortcut, which will generate a PDF in via the following sequence:

myfile.tex > myfile.dvi > myfile.ps > myfile.pdf
             myfile.aux
             myfile.log

To configure your Quickbuild button, open Kile with

Applications > Office > Kile

and click on

Settings > Configure Kile > Tools > Build > Quickbuild

and remove the existing configuration to replace with the following commands which should be run when you click Quickbuild:

LaTeX (Default)
DVItoPS (Default)
PStoPDF (Default)

Now choose ViewPDF in the "Select a Tool" box, and click New Config, call it evince, and change the command to evince. Choose Quickbuild again and add the last one to the list:

ViewPDF (evince)

When you are finished (it should look like the screenshot below) then you can click OK. Image:KileConfig.png

Writing an article

LaTeX has several built in document styles, which we mainly use two of: article, for short articles or weekly assignments, and report, for a longer essay or thesis. In Kile, click

File > New > article

to open an empty article:

\documentclass[a4paper,10pt]{article}
%opening
\title{}
\author{}
\begin{document}
\maketitle
\begin{abstract}
\end{abstract}
\section{}
\end{document}

Edit this and compile by clicking Quickbuild or pressing alt-1. The first time you will be asked to provide a filename to save the LaTeX document, enter a meaningful name such as ThreeColourProblem.tex, and click Quickbuild again. Congratulations!

Go browse the kile screenshots (http://kile.sourceforge.net/screenshots.php) to get a better feel for it. Then continue to our LaTeX Tutorials and FAQ: LaTeXTutorials and LaTeXFAQ.