Wednesday, August 24, 2011

Update to my LaTeX CV templates: Space allowed after sections now!

In preparation for setting up MultiMarkDown (MMD) to write my CV for me, I've been thinking about ways to refactor my old résumé/CV LaTeX templates to make them look a little cleaner. A fix I came up with tonight should help with that, and I think it will also make the templates easier for others to work with even if they're not doing anything with MMD.

In particular, the \section macro used to be renewed as a \marginpar with some other ugly stuff. Putting the sections in the margins caused problems because people like to put spaces after the sections, which generates a \par that means the section content will not be aligned with the section heading in the margin note. So the old way I got around that problem was to force people not to use spaces between \section and the section content. If they needed visual space in their source code, they could use comments to do that.

Well, I've swapped out that ugly definition for a slightly less ugly one that uses \llap (with a \smashed \parbox) and some creative gobbling. In particular,
% The section headings
% Usage: \section{section name}
        \parbox[t]{\marginparwidth}{\raggedright #1}}}%
The \vspace and \par combination should ensure that an additional \par isn't added by LaTeX. So before you were restricted to things like...
\section{Stuff} \begin{bibsection} %...
But now you don't have to be so careful about the whitespace. You are allowed:

\begin{bibsection} %...

So that's cool. Much more readable.

You can get my most recent LaTeX CV templates at their page on my website. You can find a detailed history of the source code changes within my Mercurial repositories of documents.

(updated: new \gobblepars allows for arbitrary amount of space after each \section)
(updated: replaced \gobblepars with \par hack that still allows for arbitrary amount of space after each \section but also prevents lists from adding a \par when placed directly after a \section; consequently, adjusted all of the lone-lists to get rid of their leading negative vertical space (probably can get rid of them now, actually). I'm trying to shift toward using conventional lists (or perhaps conventional modifications of them from paralist or enumitem))

1 comment:

Ruby Claire said...

LaTeX allows markup to explain the framework of a papers, so that the person need not think about demonstration.

Cv Template