# LaTeX

Jean-Baptiste
Rouquier

Work

Présentation

Programmation

Prépas

Version française

## Use pdfLaTeX and hyperref !

Simply
\usepackage{hyperref}
in the header, then compile with
pdflatex foo.tex
This way, the pdf file conains bookmarks (click for direct access to any section), when refering to "theorem 4.2", "4.2" is a link towards this theorem, it's possible to search all occurences of a word in the text (Ctrl+F), to copy and paste the title and author names (avoid mispelling your name when citing your paper). The default of ps2pdf is to convert images to jpeg format: excellent for photos, disaster for diagrams: bigger size, bad look. So, use pdflatex.

Sure, most if not all of this is possible with latex, provided you use dvipdfm (and not dvipdf), which converts directly from dvi to pdf. But I've seen many files which have the shortcomings of both the paper and the electronic format. If you're a guru, fine. Otherwise, you can't say anymore that you don't know the solution: use pdflatex.

That's all for moral. (If under windows, still use ghostview to preview your file, as opposed to Adobe Reader, it allows to modify the pdf file while viewing it.)

## Beamer

If you're composing slides with LaTeX (I've never seen anything else that produces acceptable mathematical formulas), you need beamer. Since comparative advertising is allowed here, it find it far superior to prosper (thus superior to "slide" or "seminar"). Proof:

• Several modes, to produce
• a "presentation" version: components of a slide (like list items) appear one by one, it's possible to incrementally draw a figure;
• a "handout" version to print the slides: no slide for section transition, only one slide for the whole list...;
• and above all, an "article" version: A4 printable, with each slide as a paragraph, with the class you want, like "book" ou "article".
• Easy navigation: clickable outline, titles of subsection are (optionnaly) displayed, frame number x/total number of frames...
• Does not depend on seminar which caused problems: a clean code on rock foundations, not a stack of unavoidable adds-on.
• Nice way to define when material should appear on the slide, for instance "appear on slides 1,2,3,  6,  8,9,10 and 14 to fin" is possible (and written <-3,6,8-10,14->). It possible to postpone a proof to the appendix: compose the full slide in your document, saying "don't display the second part", and call this slide from the appendix. Each section (optionnaly) begins with an outline slide, with current section highlighted.
• compile with pdflatex or latex, at your option.
• Any photo as background, stored only once in the pdf (saving disk space).
• Use one of the many available themes or define your own. Themes management is modular: one can independently change colors, layout, fonts. Themes define distinct styles for title slide, outline slide, normal slide...
Excellent manual, its only imperfection is to be very detailed thus long :-) but it contains a tutorial, there are complete examples ready to be adapted (in folder "solutions") and even many tips on how to write good slides (slightly irritating if you already follow them).

## WhizzyTeX

Once you've switched to LaTeX: I use WhizzyTeX, and find it bewilderingly amazing. Simple idea: just type your LaTeX source file, a viewer display the dvi file in real time. No command to launch.

For happy Debian or (K)Ubuntu users:

 apt-get install advi whizzytex
emacs foo.tex
M-x whizzytex-mode
("advi" means "active dvi", it's a dvi viewer written in Ocaml, which allows to fully benefit from the power of WhizzyTeX. foo.tex is one of your usual LaTeX files. It is recommended to check that latex foo.tex does not generate errors before launching WhizzyTex mode. (If foo.tex dos notcontains \begin{document}... \end{document}, WhizzyTeX will ask you in which file is foo.tex included.)
And go: just type in emacs... display is updated as you type

I specially appreciate:

• "jump to next error" (C-c j). The first error is highlighted, with corresponding error message;
• display limited to current piece (at your option: chapter, section, whole document...). No more "includeonly" or commenting outing the includes.
• A cursor in the dvi follows the cursor in emacs. Shift+click on the dvi put the emacs cursor at the same place.

Does not work with aeguill.sty out of the box (untested since version 1.3). Two solution, equivalent from WhizzyTeX point of view:

• create the file ~/.whizzytexrc (or ~/.whizzy/whizzy.sh) containing the line (can slow down compilation, even of files not using aeguill.sty):
DVICOPY=dvicopy
• or add in the first 1000 characters of your .tex file the exact line (no space before "%"):
%; whizzy -advi -dvicopy dvicopy

WhizzyTeX has been reported to work under windows with Cygwin, but it's involved. The official website give some hints.

## WhizzyTeX + Beamer

Sure, one wants to use both at the same time. It's neither out of the box nor perfect, but it works. Tested with WhizzyTeX 1.3.0 and beamer 3.06.

The bibliography can't be edited under WhizzyTeX (but it can be in the document as long as one does not go to this frame). Please tell me if you have a solution ! Here is a minimal example demonstrating the problem.

• Optionnal: choose the handout mode of beamer:
\documentclass[handout]{beamer}
• Compile three times with pdflatex
• to ensure no problems appear during compilation,
• to create auxiliary files (aux, toc, ...) with correct page numbers,
• because the first compilation is slower.
• Launch the emacs whizzytex mode with option -pdf (which means launching it via C-u C-c w or choosing this option from the menu or writing
%; whizzy -pdf
near the beginning of the file). Instead of passing this option, on can copy this file whizzy.sh into
~/.whizzytex/
You might need to adapt a few lines (see inside the downloaded file) depending on the latex tools of your distribution. (Example: pdfinitex instead of pdfetex -ini).
• Add the following lines to ~/.emacs:
 ;; WhizzyTeX (add-hook 'whizzytex-mode-hook '(lambda ()   ; use paragraph mode for the LaTeX class "beamer":   (add-to-list 'whizzy-class-mode-alist '("beamer" . paragraph))   (whizzy-default-bindings) ;keep default whizzytex-mode-hook )) ;slice on every frame while in paragraph mode: (setq whizzy-paragraph-regexp "\n\\\\frame\\b[^{]*{") ;or slice also on sectionning: ;; (setq whizzy-paragraph-regexp "\\\\\$$\\(s\\(ubs\\(ub\\|\$$\\|\\)ection\\)\\|chapter\\|part\\|frame\\)\\b[^{]*{") 
• Close and relaunch emacs, open your tex file, launch whizzytex mode and cross your fingers.
• At my first attempt, (with WhizzyTeX 1.2.2 and beamer 3.01), the fact that the four PDF files in /usr/share/texmf/tex/latex/beamer/base/art/ (nammed beamericon*) begin with "%PDF-1.3" was problematic. It seems to be solved. You can anyway try to replace them with those level 1.0 PDF files.