LaTeX

Why LaTeX?

As soon as one wants to write docs of quality, it is essential to formalize the concepts that one handles at a superior level of abstraction. And, for the moment, LaTeX is the only environment that suits thereto.

TeX engines

You might run various OpenOffice plugins/add-ons to convert to/from LaTeX code. Under the Ubuntu distribution, you have such packages if you search aptitude using the keyword "latex".

But the best is to write natively in LaTeX… Or, at least, to write your text in the Emacs Org mode, and let it be converted to LaTeX.

TeX Live

TeX Live 2009 (Linux, Windows) is an easy way to get up and running with TeX. It provides a comprehensive TeX system. It includes all the major TeX-related programs, macro packages, and fonts that are free software, including support for many languages around the world.

TeX Live installation over the Internet

Download the network installer for Linux. Unpack it, and run the install-tl script:

sudo ./install-tl --location http://mirror.ctan.org/systems/texlive/tlnet

The only option you absolutely have to set is under Options: select create symlinks in standard directories so that the system immediately works after the installation.

<L> create symlinks in standard directories:  [X]
            binaries to: /usr/local/bin
            manpages to: /usr/local/man
                info to: /usr/local/info

Then, adding the TeX Live binary directory to your PATH is not necessary anymore:

PATH=/usr/local/texlive/2009/bin/i386-linux:$PATH

Another option you may want to change is the Installation scheme, depending on whether you want to install a full collection of packages or not.

Standard directories

TEXDIR (the main TeX directory)

/usr/local/texlive/2009

TEXMFLOCAL (directory for site-wide local files)

/usr/local/texlive/texmf-local

TEXMFSYSVAR (directory for variable and automatically generated data)

/usr/local/texlive/2009/texmf-var

TEXMFSYSCONFIG (directory for local config)

/usr/local/texlive/2009/texmf-config

TEXMFHOME (directory for user-specific files)

~/texmf

Package manager

TeX Live will be continuously updating packages as they are released to CTAN. To install any or all of these updates, use the tlmgr program.

sudo tlmgr update --self
sudo tlmgr update -all

Fonts

TeX Live can install a couple of almost free fonts in texmf-local.

sudo getnonfreefonts-sys --all
arial-urwArial (URW)
classicoClassico (URW)
dayromanDayRoman (Apostrophiclabs)
eurofontEuro symbols (Adobe)
garamondGaramondNo8 (URW)
lettergothicLetterGothic (URW)
luximonoLuxiMono (Bigelow & Holmes)
vntex-nonfreeVnTeX nonfree (Han The Thanh)
webomintsWebomints (Galapagos Design Group)

Package documentation

With TeX Live, to get documentation about a package (inputenc, for example), type:

texdoc inputenc

User-specific files

Type the following to check the root directory of where to put private .sty files:

kpsewhich --var-value TEXMFHOME

MiKTeX

MiKTeX (Windows) is a TeX implementation.

If you want to add your own TeX files, click "MiKTeX" -> "Settings" and go to the "Roots" tab. Click "Add" and browse to your root directory (for example: $HOME\texmf, the default directory for user-specific files under Ubuntu) – which must comply to the TeX Directory Structure (tds) documentation.

Whenever you install or remove files, don't forget to refresh the file name database (FNDB), by clicking on the button "Refresh FNDB" on the "General" tab, or by launching:

texhash ~/texmf

With MiKTeX, to get documentation about a package (inputenc, for example), type:

mthelp inputenc

TeX editors

AUCTeX (Linux, Windows) is an Emacs package that supports writing and formatting LaTeX files.

sudo aptitude install auctex

Note – To make AUCTeX working, I took the precompiled Emacs + AUCTeX bundle for Win32 (at http://www.gnu.org/software/auctex/download-for-windows.html), and copied the auctex directory and the tex-site.el file into my load-path.

Texmaker (Linux, Windows) is a free LaTeX editor that has many advantages over TeXnicCenter (Windows-only, no UTF-8):

  • French GUI (if required)
  • more simple interface
  • easier compilation's concept (no profiles)
  • since few years, TeXnicCenter don't create LaTeX -> PS -> PDF profile and it is hard to reconfigure. With Texmaker, no such trouble
  • panels with many math symbols available by click
  • PSTricks and metapost keywords available in panels
  • extensibility of implemented control sequences
  • UTF-8 editor
  • multi platform editor (Linux, Windows)

Though, its disadvantages are:

  • less complete GUI tha TeXnicCenter
  • only errors are detected (with TeXnicCenter, also warnings and overfull hbox are detected)

http://www.xm1math.net/texmaker/top.png

TeXworks seems to be another good choice for new users. And it should be part of coming TeX Live releases…

Word-to-LaTeX Convertor (Windows) converts documents written in Microsoft Word into LaTeX format.

Including graphics

If it didn’t work, or is misaligned, prepare to waste an afternoon. Try: minipage, raisebox, figure.

TikZ editor

KtikZ is an editor for the TikZ language, helping you to create TikZ (from the LaTeX pgf package) diagrams for your publications.

Preamble

Here I will post a typical preamble.

Interesting Packages

Here is a list of interesting LaTeX packages:

  • movie15 – embed movies, sounds and 3D objects into PDF documents

Beamer

Install

hg clone http://bitbucket.org/rivanvx/beamer
hg pull

Extra

> I usually use powerpoint for my slide presentations, but I am trying > to migrate to beamer. One of the few things I really miss about > powerpoint, however, is the Presenter View:

Not really the same but try http://impressive.sourceforge.net/ Then you will start to miss things when in powerpoint. :-)

sudo aptitude install impressive

Interesting Macros

\nobreak … *

\penalty-150 % par exemple

\normalfont \normalcolor

\def\wider#1#2{\scalebox{#1}1{#2}}% \def\taller#1#2{\scalebox{1}[#1]{#2}}%

Pour que l'introduction soit dans la TOC :

\chapter*{Introduction}\label{chap-introduction} \addcontentsline{toc}{chapter}{Introduction} \markboth{INTRODUCTION}{INTRODUCTION}

>> Je croyais qu'avec \ifx, quand un truc était pas défini il était >> remplacé par \relax. Le test normal est un \ifx avec une commande non definie: \ifx\<nom commande>\@undefined

Utiliser

plutot que \\.

Utiliser l'environnement samepage pour éviter des séparations intempestives de certaines lignes.