1

I am trying to used the command \ref{} to reference a figure (which has a label), but am receiving the error message 'Undefined control sequence', and the reference is not working. Here is an example of what I'm trying to do:

\begin{figure}[htb]
    \centering
    \includegraphics[width=10cm, height=10cm]{ch-results/Figures/filename}
    \caption{Caption here}
    \label{fig:example}
\end{figure} 
Notice how cool figure \ref{fig:example} is!

The figure shows up fine, but the resulting line of text is: enter image description here

Instead I want this to say:

enter image description here

For reference, the relevant part of my header is

\documentclass[12pt,lot, lof]{puthesis}
\newcommand{\proquestmode}{}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{subcaption}
\usepackage[skip=2pt, font=scriptsize,labelfont=bf]{caption}
\usepackage{subfigure}
\setlength{\LTcapwidth}{\textwidth}
\ifdefined\printmode
\usepackage{url}
\else
\ifdefined\proquestmode
\usepackage{hyperref}
\hypersetup{bookmarksnumbered}
\makeatletter
\hypersetup{pdftitle=\@title,pdfauthor=\@author}
\makeatother
\else
\usepackage{hyperref}
\hypersetup{colorlinks, bookmarksnumbered}
\makeatletter
\hypersetup{pdftitle=\@title,pdfauthor=\@author}
\makeatother
.
.
.
\begin{document}

I am new to LaTeX and the majority of this is coming from a template, so I have no idea where to begin looking for the issue - I've tried googling around quite a bit, but I haven't been able to find anything that works - any help would be greatly appreciated!

closed as unclear what you're asking by user31729, Troy, Stefan Pinnow, TeXnician, Bobyandbob Apr 23 '18 at 16:07

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Welcome to TeX.SE. Try deleting the instruction \usepackage{subfigure} and recompiling twice. The subfigure package is incompatible with the caption and subcaption packages. (If the template you've acquired loads both packages, the template's author should hang his/her head in shame...) Moreover, subfigure has been deprecated for a decade or more and shouldn't be used any longer. – Mico Apr 18 '18 at 1:13
  • 2
    Or better, if possible, dot not use templates. Start with a clean preamble and then add only what you really need/understand. Templates are useful at first to learn about some packages and commands, and take ideas about document layouts, but they rarely can prevent you from knowing what you are doing ... and debug third templates is a pain in the ass. – Fran Apr 18 '18 at 7:40

Browse other questions tagged or ask your own question.