LaTeX Lessons Learned

This post is a collection of lessons learned as a LaTeX newbee. Hopefully these will help others save some time when starting out. LaTeX can be pretty daunting on first sight.

List Line Spacing
The following code-snippet shows how to reduce the line-spacing between enumerate/itemize list items:
\begin{enumerate}
\item\setlength{\parskip}{-3pt} Item line one.
\item Item line two.
\item Item line three.
\item Item line four.
\end{enumerate}
Page Margins
There are many different ways to control page margins. The easiest solution I've come across is to use the following package declaration for 1 inch margins all around:
\documentclass[10pt,a4paper]{article}
\usepackage[a4paper,bottom=1in,top=1in,left=1in,right=1in]{geometry}
BibTeX Bibliography Title Casing
If you're using BibTeX in your LaTeX documents, you may have noticed that Titles in the Biblography/References section at the end of your documet get converted into sentence-case format. That is, the first letter of the Title is capitalized and everything else is made lowercase. This is fine in some cases but an issue when titles contain acronyms or names. I experienced this using the natbib package, but it appears to be caused by the underlying bibtex parser package. The easiest cludge to prevent this is to add double curly braces around your title properties in your bibtex library file. For example:
@STANDARD{LOM,
title = {{1484.12.1 IEEE Standard For Learning Object Metadata}},
organization = {IEEE Learning Technology Standards Committee},
revision = {15 July 2002},
year = {2002},
url = {http://ltsc.ieee.org/wg12/files/LOM_1484_12_1_v1_Final_Draft.pdf},
}
Cross-Referencing
Cross-referencing to figures, sections, chapters or even footnotes can all be done using the \label command. Examples include:
\section{Introduction}\label{sec:intro}
Foo bar.
\section{Conclusion}
As noted in Section \ref{sec:intro}, foo is a bar.

``Some long quote.''\footnote{Author, Source, \url{...}\label{fn:quote}}
Foo bar ``another quote from same source''\footref{fn:quote}

Figures and Images
\begin{figure}[ht!]
\centering
\includegraphics[scale=0.7]{images/Pretty_Picture.jpg}
\caption{A picture's worth a thousand words}
\label{fig:prettypic}
\end{figure}
TeXnicCenter
If using TeXnicCenter in Windows, be very careful when using the spelling checker! When correcting a word that has no suggestions you can edit the text directly in the top-part of the dialog. This however seems unstable and it's easy to either replace a word with a whole paragraph or the other way around. I prefer just creating a PDF output, copy-pasting the text in MS Word, correcting any red squiggles in the LaTeX source.

More to come later...

Comments

Popular posts from this blog

Wkhtmltopdf font and sizing issues

Import Google Contacts to Nokia PC Suite

Can't delete last blank page from Word