Miscellaneous LaTeX tips

This is a collection of short LaTeX tips that I picked up during the writing of my thesis and various journal articles and papers.


Set caption position for subfigures, subtables and subfloats

For regular floats such as tables and figures, the caption position can be set to above or below the float by simply issuing the caption command above or below the float contents.

For subfloats using the subfig package, the caption position is controlled by the \captionsetup command of the \caption package. The subfig documentation was a bit confusing about this but \captionsetup can be used as follows. First, include the caption package:


Then, issue a \captionsetup command, either right after \usepackage{caption} or just before the figure or table for which you want to control the subcaption position:


FLOAT_TYPE can be subfigure or subtable for controlling the caption position for the corresponding type of float. POSITION can be top or bottom.

The following code will put the subcaptions on top of the subfigures (remember to replace placeholder with the name of a graphic file that you want to include):

	\subfloat[Caption 1]{\includegraphics[width=1in]{placeholder}}\quad
	\subfloat[Caption 2]{\includegraphics[width=1in]{placeholder}}
	\caption{Main figure caption.}

The result is this:

Subfigure caption is placed on top of subfloat using a captionsetup command.

The default is to put the caption below the subfigure, but you can explicitly specify this by changing the \captionsetup command:


The result will look like this:

Subfigure caption is placed below of subfloat using a captionsetup command.

See my other page on LaTeX captions for more you can do to customize and style them.


Enumeration formatting

The enumerate package gives more control over enumerations. Include the package in your LaTeX document:


You can then control how the numbering or lettering occurs by specifying a format argument when starting an enumeration:


FORMAT is a user defined string. Special characters specify the numbering or lettering convention, while any other characters are taken as normal LaTeX code that is reproduced for each item. The special characters are:

Special CharacterEnumeration Style
AUpper case letters
aLower case letters
IUpper case Roman numerals
iLower case Roman numerals
1Arabic numbers

The following produces lower case Roman numerals with a ”)” after it:

	\item This is an item.
	\item This is an item.

The above code will produce this:

The enumerate package allows styling of enumerations, including small roman numerals.

The following produces lettering of the form “Item A:”

\begin{enumerate}[{Item} A:]
	\item This is an item.
	\item This is an item.

The above code will produce this:

A second example of using the enumerate package shows how phrases can be specified as part of the enumeration.

Note that since “Item” contains a special character (I) of the enumerate package, it is written inside a { } clause. This tells the package to ignore the “I” as a special character.

You can also put other LaTeX code in the format string, such as an \hspace:

	\item This is an item.
	\item This is an item.

Table of Contents

Adding entries to the table of contents

Depending on your document class, the table of contents sometimes does not automatically have entries for some parts of the document, especially if they are not formally declared as \chapter, \section, etc. For example, in my thesis, the List of Figures did not automatically have an entry included in the table of contents. I was able to manually include the List of Figures entry with the following:

\cleardoublepage % Start a new page for the list of figures. Make it right handed for two-sided documents.
\phantomsection % ensure that the hyperlink in TOC to this section is correct.
\addcontentsline{toc}{chapter}{List of Figures} % add to table of contents.
\listoffigures % generate the list of figures.

The first three lines of code create the proper List of Figures heading and puts it into the table of contents, while the last line generates the List of Figures itself and is unrelated to the task of adding entries to the table of contents. The first three lines of code can be broken down as follows:

  • \cleardoublepage puts the LOF on a new page, right handed if printing two-sided. This command is needed only if you intend to add the new entry as a chapter in the table of contents.
  • \phantomsection is needed if you use PdfTeX with the hyperref package and you specified the bookmarks option for hyperref. This allows the hyperlink in the TOC to link to the appropriate place in the document.
  • \addcontentsline is used to add the entry into the table of contents.

You can add chapters, sections, etc. to the TOC by modifying the code above. Sections do not need \cleardoublepage and you will need to change \\addcontentsline to add a “section” instead of a chapter. An example of a section that you would need to add yourself to the TOC might be an unnumbered section, which is defined in the document as a \section* rather than \section.

Add a page break to the table of contents

If you want a page break in the table of contents, you can add a “section” in your document which gets turned into a page break when the table of contents is created. Just insert the following line:


The line above should be inserted in your document content, just like \section commands.


I would love to hear your feedback. Enter your comment below [ Terms of Use ]:

About Peter Yu I am a research and development professional with expertise in the areas of image processing, remote sensing and computer vision. I received BASc and MASc degrees in Systems Design Engineering at the University of Waterloo. My working experience covers industries ranging from district energy to medical imaging to cinematic visual effects. I like to dabble in 3D artwork, I enjoy cycling recreationally and I am interested in sustainable technology. More about me...

Feel free to contact me with any questions about this site at [user]@[host] where [user]=web and [host]=peteryu.ca

Copyright © 1997 - 2017 Peter Yu