# undefined control sequence \label

I am trying to run the following script

\documentclass[•]{article}
\usepackage{subfigure}

\begin{document}
\begin{figure}[htp]
\begin{center}
\subfigure[Original image]{\label{fig:edge-a}\includegraphics[scale=0.75]{1}}
\subfigure[After Laplace edge detection]{\label{fig:edge-b}\includegraphics[scale=0.75]{3}} \\
\subfigure[After Sobel edge detection]{\label{fig:edge-c}\includegraphics[scale=0.75]{2}}
\end{center}
\caption{Various edge detection algorithms}
\label{fig:edge}
\end{figure}
\end{document}


The basis for this script is this link where the author explains how to place several figures with local and global captions for each figure and the entire figure set, respectively. The only difference is that I am using my own images and my own preamble (the link does not offer one).

When I run it I get the following error:

! Undefined control sequence. \label {fig:edge-a}\includegraphics[scale=0.75]{1} ...ig:edge-a}\includegraphics[scale=0.75]{1}}

Why does this occur? Isn't the \label control sequence independent from any usepackages? How can I solve this problem?

• The problem is \includegraphics, not \label. You're missing \usepackage{graphicx} to use \includegraphics (The OP of the given link does have \usepackage{graphicx,psfrag} however – user31729 May 31 '17 at 13:53
• Always show tex error messages in a code block not as a quotation, and preserve the original line endings, the messages change meaning if line breaks are changed. – David Carlisle May 31 '17 at 15:34

The error you get is

! Undefined control sequence.
<argument> \label {fig:edge-a}\includegraphics
[scale=0.75]{1}
l.7 ...fig:edge-a}\includegraphics[scale=0.75]{1}}


which shows the undefined control sequence is \includegraphics. This is because you don't have

\usepackage{graphicx}


Beware that subfigure has been deprecated several years ago and its successor is subfig; the command \subfigure should be changed into \subfloat.

\documentclass{article}
\usepackage{subfig}
\usepackage{graphicx}

\begin{document}

\begin{figure}[htp]
\centering
\subfloat[Original image]{\label{fig:edge-a}\includegraphics[scale=0.75]{1}}
\subfloat[After Laplace edge detection]{\label{fig:edge-b}\includegraphics[scale=0.75]{3}} \\
\subfloat[After Sobel edge detection]{\label{fig:edge-c}\includegraphics[scale=0.75]{2}}
\caption{Various edge detection algorithms}
\label{fig:edge}
\end{figure}

\end{document}


Use \centering, not the center environment.

• That works but unfortunately the images are not appearing. they are jpegs of 565X605 dimension... – user32882 May 31 '17 at 14:07
• Oh I get it because of the [demo] option in \usepackage[demo]{graphicx}. Nevermind your answer is correct thank you – user32882 May 31 '17 at 14:10
• @user32882 Sorry, I forgot to remove it. – egreg May 31 '17 at 14:11