Put section numbers in the margins of your LaTeX reports

For the first installment of our LaTeX mini-series, I thought I’d share one neat little trick involving a tweak to the layout of section headers in LaTeX documents: putting the section number counter in the margin.

This will create the illusion of a “hanging” paragraph below each header. Just add this snippet to your preamble:

\makeatletter\def\@seccntformat#1{\llap{\csname the#1\endcsname\quad}}\makeatother

The effect should look something like this:


As a side note: margins are a sore spot for me in my LaTeX career. I appreciate the default margin-width algorithms, which try to maximize readability by restricting the number of characters per line to ~60. But for many practical layout purposes, smaller margins are desirable. Nevertheless,when wider margins are in use, I particularly like to employ this design aspect in order to balance out the distribution of text on the page without impacting the readability of the paragraphs.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s