Henry Poon's Blog

Really Handy LaTeX Commands

I just started writing in LaTeX and all too often I find myself forgetting commands that I had looked up a few minutes ago.  Therefore, I thought it’d help if I compiled a list of these.

Paragraph Spacing

setlength{parskip}{7pt}

This goes in the preamble of the document (after the document class stuff, but before the begin document line).

Removing Page Numbers

thispagestyle{empty}

This gets rid of page numbers for that particular page, but the numbering sequence continues on the next page.

Adding Unnumbered Sections into the TOC

section*{Introduction}
addcontentsline{toc}{section}{Introduction}

By default, unnumbered sections do not appear in the table of contents and therefore they must be added manually.

Defining a New Style with fancyhdr

fancypagestyle{plain}{%
fancyhf{}}% clear all header and footer fields

New style definitions should go before the very last curly brace.

Unnumbered Sections Not Working with leftmark and rightmark

section*{Introductionmarkboth{Introduction}{}}

For some reason, unnumbered sections don’t play nice with fancyhdr and don’t get treated as real sections when the leftmark and rightmark commands are used.  By using markboth, it fixes the problem.  Now my headers show the correct section name.

Bulleted List

begin{itemize}
item Here is a bullet.
item Here is another bullet.
end{itemize}

Numbered List

begin{enumerate}
item Here is item one.
item Here is item two.
end{enumerate}

Referencing Sections by Name

section{MyFirstSection} label{marker}
section{MySecondSection}
In section~nameref{marker} we defined...

Requires the hyperref package!  Put the line below in the preamble.

usepackage{hyperref}

Linking to a Website

href{http://www.example.com}{Link}

Umlauts

"{o}

That gives an o with an umlaut.  Just replace the letter to get an umlaut on a different character.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Next Post

Previous Post

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2024 Henry Poon's Blog

Theme by Anders Norén