Home General LaTeX tips and tricks → Custom captions [Previous Page] [Question index] [Next Page]

19. How can you get nicer figure captions?


Use the caption package by Harald Axel Sommerfeldt.

Example usage

In the preamble:


In the document:

    \caption{A programmable compiler.}\label{fig:programmable-compiler}

Result, before

'Before' screenshot

Result, after

'After' screenshot

Not one of the most earth-shattering packages, perhaps, but I certainly like my captions a whole lot better this way.

Note that for a while, people often used the more experimental caption2 package instead of caption. The two versions were merged in December 2003, however, and from then on caption has become the single recommended package again.

Things to watch out for

The custom package is frequently updated, and the newer versions sometimes break compatibility with older versions. If you try to compile my thesis sources with a different TeX distribution and you run into trouble, make sure that the caption version is not too old or too new. (Changing the preamble invocation to match a different version is fairly trivial -- just consult the excellent caption documentation.)
[Previous page] [Question index] [Next page]

Leo Breebaart (leo@lspace.org)
Last updated: 27 June 2016