Notes On LaTeX


Why use LaTeX? LaTeX gives consistently stunning results. There is something of learning curve with LaTeX, so I hope this is helpful. The best reference for learning LaTeX is unquestionably the LaTeX Wikibook.

Bare minimum for a valid document:

\documentclass{article}

\begin{document}
Hello world.
\end{document}

Full featured example:

% specify paper size for fullpage package
\documentclass[a4paper]{article}
 
% enable verbatimtab command
\usepackage{moreverb}
% wider margins
\usepackage{fullpage}
 
% characters 'eaten' by latex: fi fl ff ffi é “
 
% nicer paragraphs with whitespace between and no indent
\setlength{\parindent}{0mm}
\setlength{\parskip}{\medskipamount}
 
\begin{document}

\title{Main Title of Document}
\author{Joe Bloggs}
\maketitle
 
Hello world.
 
\subsection*{Big section}
A major section title is above. Note the asterisk to stop latex using
a numbering scheme.

\subsubsection*{Smaller heading}
More verbage.
 
\begin{enumerate}
\item The first numbered point
\item Another numbered point
\end{enumerate}

\begin{itemize}
\item This is a bullet point
\end{itemize}
  
\end{document}

Slides

\documentclass{beamer}

\usetheme{Warsaw}

\title[Main title]{Big Title:\\Blah blah}

\author{Joe Bloggs}
\institute{Someplace}

\begin{document}
  
\begin{frame}
\titlepage
\end{frame}
 
\begin{frame}
Hello world!
\end{frame}
 
\end{document}

Going from good to great

The default font was created some time ago, and is not ideal. Consider using a newer font (code below). You can see a comparison of fonts with full maths support here.

\include{mathpazo}

For documents that are not laden with maths, you can go further. Using XeTex with the fontspec package you can use any TrueType font on the system (including typing unicode properly, useful for foreign text). I recommend the Gentium font for more attractive results.

Header for documents is now as follows:

\documentclass[a4paper]{article}

\usepackage{fullpage}
\usepackage{fontspec}

\setmainfont[Mapping=tex-text]{Gentium}

\setmonofont[Scale=0.86]{Droid Sans Mono}
 
% newline between paragraphs, no indent
\setlength{\parindent}{0mm}
\setlength{\parskip}{\medskipamount}
  
\begin{document}

Simply feed this into the xelatex command to produce your pdf as you would with pdflatex.

Hyperlinks

To produce a pdf document with links (e.g. contents pages) then consider the package hyperref.

Redefining the numbering scheme for lists

\renewcommand{\labelenumi}{(\alph{enumi})}
\renewcommand{\lableenumii}{(\roman{enumii})}

Redefining the numbering scheme for subsubsections

% simple numbering scheme 1. 2. 3. etc
\def\thesubsubsection{\arabic{subsubsection}.}
% or use (a) (b) (c) and so on instead
\def\thesubsubsection{(\alph{subsubsection})}

Other useful LaTeX tools

Including code samples

The verbatim environment stops you needing to escape LaTeX reserved characters and is formatted using a monospaced font. Sadly it ignores tabs, so you may instead want to use the verbatimtab environment from the moreverb package.

For proper language highlighting, there is a listings package but it uses rather strange fonts. A better solution is Pygments, a generic highlighter that can ouput LaTeX code.

Using IPA

See the tipa package

Parse trees

Linguistics style, using the parsetree package:

\begin{parsetree}
    ( .S. 
        (.NP.  `we')
        ( .VP.
            (.V.    `gave' )
            (.NP.   `them')
            (.NP. ~ `a toy')
         )
    )
\end{parsetree}

Recent Posts

Pattern Matching in Emacs Lisp

These Weeks in Remacs

This Week in Remacs

Announcing Remacs: Porting Emacs to Rust

Introspecting Glue Code