LaTeX showlabels Package — Keep track of all defined labels

May. 23, 2025 • Updated May. 24, 2025

LaTeX showlabels package is used to help us to “track of all the labels you define, by putting the name of new labels into the margin whenever the \label command is used”1. Here is an example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\usepackage{graphicx,subfig}
\usepackage[
	colorlinks,
	linkcolor=blue,
	urlcolor=blue,
	citecolor=red]{hyperref}

\usepackage{showlabels}
\showlabels{bibitem}
\showlabels{cite}

\begin{document}

\section{Section}
\label{sec1}
\subsection{Subsection}
\label{subsec1}
\subsubsection{Subsubsection}
\label{subsubsec1}

\begin{figure}[h]
\def\CE{0.20}
\centering
\subfloat[]{\includegraphics[height=\CE\textwidth,width=\CE\textwidth]{ctanlion.eps}\label{fig1-1}}\hfill
\subfloat[]{\includegraphics[height=\CE\textwidth,width=\CE\textwidth]{ctanlion.eps}\label{fig1-2}}\hfill
\subfloat[]{\includegraphics[height=\CE\textwidth,width=\CE\textwidth]{ctanlion.eps}\label{fig1-3}}\hfill
\subfloat[]{\includegraphics[height=\CE\textwidth, width=\CE\textwidth]{ctanlion.eps}\label{fig1-4}}
\caption{CTAN lion}
\label{fig1}
\end{figure}

\begin{subequations}
\begin{align}
&\mathrel{\phantom{=}} (a+b)(a^2-ab+b^2) \label{eq1-1}\\
&= a^3 - a^2b + ab^2 + a^2b - ab^2 + b^2 \label{eq1-2}\\
&= a^3+b^3 \label{eq1-3}
\end{align}\label{eq1}
\end{subequations}


\begin{equation}
\begin{split}
&\mathrel{\phantom{=}} (a+b)(a^2-ab+b^2) \\
&= a^3 - a^2b + ab^2 + a^2b - ab^2 + b^2 \\
&= a^3+b^3 
\end{split}\label{eq2}
\end{equation}

\cite{ref1}

\cite{ref2}

\cite{ref3}

\begin{thebibliography}{1}
\bibitem{ref1} The showlabels package. \href{https://mirror-hk.koddos.net/CTAN/macros/latex/contrib/showlabels/showlabels.pdf}{showlabels.pdf}.

\bibitem{ref2} The showlabels package. \href{https://mirror-hk.koddos.net/CTAN/macros/latex/contrib/showlabels/showlabels.pdf}{showlabels.pdf}.

\bibitem{ref3} The showlabels package. \href{https://mirror-hk.koddos.net/CTAN/macros/latex/contrib/showlabels/showlabels.pdf}{showlabels.pdf}.
\end{thebibliography}
\end{document}

img-1

In the above case, with the default option, the label of sub-figures cannot be displayed as expected. The package also provides other options23, and the inline option can help to solve this problem to some extent:

1
2
3
4
5
6
7
% ...

\usepackage[inline]{showlabels}
\showlabels{bibitem}
\showlabels{cite}

% ...

img-1


Besides, the package also supports formatting the labels3:

1
2
3
4
5
6
7
8
% ...

\usepackage{showlabels}
\renewcommand{\showlabelfont}{\small\slshape\color{red}}
\showlabels[\fbox]{bibitem}
\showlabels[\fbox]{cite}

% ...

img-1

or even labels rotating by the rotating package3:

1
2
3
4
5
6
7
8
9
10
11
12
% ...

\usepackage{showlabels}
\renewcommand{\showlabelfont}{\small\slshape\color{red}}
\showlabels{bibitem}
\showlabels{cite}

\usepackage{rotating}
\renewcommand{\showlabelsetlabel}[1]
{\begin{turn}{60}\showlabelfont #1\end{turn}}

% ...

img-1


References