More on writing my thesis with LaTex

As I mentioned previously, I am writing my thesis using the LaTeX markup system, and thought I would put together a few words on my experience and things I have found. This includes formatting tables, including acronyms, and larger landscape figures/tables. I am sure there are many other ways to to achieve the same result, but these are the ones I have found to work.

Tables

One of the minor annoyances with LaTex is tables. Although it is possible to make nice looking tables, these seem to take a bit more effort than using a word processor. Help is at hand, in the form of the website Tablesgenerator.com, which lets you paste in data or upload a csv file, and give you back the required markup. I also use the package booktabs, which adds nice spacing to tables and gives commands for the horizontal lines to make up a nice table.

Getting columns spaced correctly is fine for small tables, but when trying to squeeze a lot of information into a tight space, things become tricky again. To be fair, this is possibly just guiding you to space out information better, but sometimes a lot of information and not just numbers needs to be crammed into one table. An example is using tables to display multi-line text, something that seems to be more complicated than I would have expected. With a bit of searching, I found a solution, defining new column types to include aligned paragraphs of text. This requires including the following in the preamble, then setting the column to be C instead of c, for example, and using \newline as required.

\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}

I’ve still not quite got my head round when to use the different table environments, tabularx, tabulary, etc. cf. tabular and tabular*. It seems to be a bit of trial and error until I get something passable.

Acronyms

Technical writing includes a lot of TLAs[1]Three Letter Acronyms. I therefore wanted something that assisted with formatting these nicely (in slightly smaller caps), but also compiled a list of acronyms used in the front matter. The acronym package does this, in quite a nice way. All of the acronyms are defined upfront, which produces the table. Then in the text, just use \ac{TLA} to get “Three Letter Acronym (TLA)” on first use, then the formatted acronym thereafter. The acronym package include lots of macros to include the long, short or plural version of the acronym. I have also set it up to define in full the first usage of an acronym in that chapter and allow reversed behaviour, so the code in my preamble is:

\usepackage{relsize,etoolbox} % needed for acronym, but also used elsewhere
\usepackage[smaller]{acronym}
\preto\chapter\acresetall % needs etoolbox package (included earlier)
\newcommand{\acr}[1]{\acs{#1} (\aclu{#1})} % reversed behaviour: AC (Acronym)

Rotated pages

Occasionally a figure or table will be too wide to fit onto the page, especially with the wide margins required for thesis binding. Given these days that documents are mostly read on screen, I wanted the page to be rotated to keep the content the right way up, rather than rotating the content of the page. The solution I found requires three packages, rotating, pdflscape, and afterpage. Then to include a landscape figure, inserted into the flow of the text on the following page (i.e. without causing a big gap in the text) use the following:

\afterpage{\clearpage\begin{landscape} % nb on it's own page after this
\begin{figure}
 \centering
 \includegraphics{filename}
 \caption{Something interesting}
\end{figure}
\end{landscape}}%afterpage

 

Notes

Notes
1 Three Letter Acronyms