# Stop loosing track of labels by displaying them in the PDF

Sometimes it is hard to keep track of labels, particularly in large documents with many figures, tables or equations. Unless you remember all label names by heart, you will likely scroll up and down till you find the particular position in the text where the label is defined. The showlabels package provides a convenient way for keeping track of label names. It displays them in the PDF next to the text element it was defined for.

Usage is straight forward, it is sufficient to load the package in the preamble of the document:

\usepackage{showlabels}

By default, labels are printed to the outer margin. Options are available to display labels in the inner/left/right margin or inline. See the package documentation for more details.

Furthermore, you can print arguments to pretty much any command. This is particularly useful for cite. See below for an example.

\showlabels{cite}

Obviously, this is not something you want in the final document. Either just delete all the code related to the package or better, use the final option to mute it:

\usepackage[final]{showlabels}

Example: figure

Example: equation

Example: enumerate

Example: cite

\documentclass{article}
\usepackage{showlabels, bibentry}
\usepackage{blindtext}
\showlabels{cite}
\begin{filecontents}{publication.bib}
@article{lamport1986latex,
title={LaTEX: User's Guide \&amp; Reference Manual},
author={Lamport, L.},
year={1986},
}
\end{filecontents}
\begin{document}
\blindtext
\section{Figure}
\begin{figure}[ht]
\centering
\rule{4cm}{3cm}
\caption{default}
\label{fig:default}
\end{figure}
\section{Equation}
$$\label{eq:default}f(x)=ax^2+bx+c$$
\section{Enumerate}
\begin{enumerate}
\item First item\label{itm:first}
\item Second item\label{itm:second}
\end{enumerate}
\section{Citation}
\cite{lamport1986latex}\\
\nobibliography{publication}
\end{document}

First seen here.

#### 7 Responses to “Stop loosing track of labels by displaying them in the PDF”

• Shea

Thanks for this tip. I hope I see this article two years ago:-)

• theliberalengineer

Good package! – I wish I had known about this yesterday, my document was getting jumbled and mixed up with table, equation, and figure references.

• Charlie

I’m trying to use this package with the memoir class and it doesn’t work. Do you have any idea about implementing this package in the class memoir?

• tom

Hi Charlie,

Interesting! I briefly tried to reproduce the issue and it works for me (see code below). Please provide a minimal working example and I’ll try to help you.

Thanks, Tom.

\documentclass{memoir}
\usepackage{showlabels}
\begin{document}
\begin{figure}[ht]
\centering
\rule{4cm}{3cm}
\caption{default}
\label{fig:default}
\end{figure}
\end{document}
• Louis

Thanks a lot, I knew there had to be a way to do this.

• Louis

For those who have long labels, you might want to rotate them to avoid going over the edge of the document:

\usepackage{rotating}
\usepackage[right]{showlabels}
\renewcommand{\showlabelsetlabel}[1]
{\begin{turn}{90}\showlabelfont #1\end{turn}}