Latex

De Pontão Nós Digitais

LaTeX is system for "formatting" (typsetting) papers, books, etc. It is the standard for engineering and scientific communications.

Intro

Typesetting, writing or formatting your LaTeX paper is like writing a program. You edit a plain text file and then compile it. The "executable" is a .pdf or .dvi file which you then visualize. You can usually click on a section of the output document and go back to the text code and vice-versa.

Advantages

  • Writing large documents with LaTeX is easy to manage, as it does not weigh down your computer too much
  • Latex has automatic management and generation of cross-references, indices, table of contents, and formatting of bibliography. You focus more on the content of the work, which is what really matters, and leave the rest to LaTeX.

Practical Usage

In Unix systems, it is customary to use a very good text editor such as Vim or Emacs. In other, uncool, systems, you might have to conform to a specific IDE.


Basics

There are two ways to use latex. One is using PDFLaTeX which will produce a .pdf as output. The other is using plain LaTeX which will produce a .dvi. The advantage of the latter seems to be that it is a bit faster. However, PDFLaTeX seems the way to go in modern times.

PDFLaTeX

In pdflatex you compile your file the following way (assuming that your paper is called paper.tex):

pdflatex paper
bibtex paper
pdflatex paper.tex
pdflatex paper.tex

Assuming that your paper is called paper.tex.

Figures can be included many image formats. If you have vector graphics (a.k.a. line graphics), you should alwasy use PDF format for them.

Plain LaTeX

In plain LaTeX you compile your file the following way (assuming that your paper is called paper.tex):

latex paper
bibtex paper
latex paper.tex
latex paper.tex

Figures can be included many image formats. If you have vector graphics (a.k.a. line graphics), you should alwasy use 'EPS (encapsulated postscript) format for them. There is a script called 2eps that User:V1z can mail to you, to do the conversions.

Editors and IDEs

Vim

You can install the VimLaTeX extension[1]. It enables compiling and looking up a portion of the formatted text from the source code, as well as debugging, seeing error messages, and having shortcuts for most LaTeX commands.

By default VimLaTeX will only compile to .dvi. To get it to work with pdflatex, insert the following into your .vimrc:

let g:Tex_DefaultTargetFormat='pdf'
let g:tex_flavor = "pdflatex"
let g:Tex_MultipleCompileFormats='pdf, aux'

You can also just change this on a per-project basis, by typing:

:TTarget pdf

If you want to switch between PDF and DVI among projects, you can have a .vimrc inside each LaTeX project directory with the above 'let' commands. To support this, in your main ~/.vimrc you put

set exrc			  " enable per-directory .vimrc files
set secure			" disable unsafe commands in local .vimrc files

Emacs

Kile

See Also