# Custom floats are not labeled correctly in the listof or text references

I'm new to StackExchange and LaTeX. I am using a custom float for "schemes" using the caption package. The problem I'm having is that the label "Scheme" does not show up when using the \ref command in text, nor does it show up in the list. I have posted a MWE below:

\documentclass[letterpaper,12pt]{article}

\usepackage{graphicx}
\usepackage[listformat=simple]{caption}

\DeclareCaptionType[name=Scheme,within=section]{scheme}

\begin{document}

\tableofcontents

\listofscheme

\newpage

\section{new section}
This is a new section with \ref{sch:1}.
\begin{scheme}
\begin{center}
\caption{\label{sch:1}This is a scheme.}
\rule[-1mm]{8mm}{1cm}
\end{center}
\end{scheme}

\section{Another section}
Testing \ref{sch:2}.
\begin{scheme}
\begin{center}
\caption{\label{sch:2}This is a another scheme.}
\rule[-1mm]{20mm}{1cm}
\end{center}
\end{scheme}

\end{document}


The List of Schemes only has the scheme numbers, but I want "Scheme" prefixed to the number to say "Scheme 1.1"

If I use the \ref command in text, I get a similar problem; it only shows the number, not the "Scheme" label. If I can change my code or message to be more meaningful, let me know since I'm a n00b. Additionally, I cannot use the tocloft package; it does not mesh with the thesis template from my school. The template does not affect the results, I get the same thing from the MWE as I do from my full document using the template. Any help would be much appreciated

• \ref usually gives back the number. I guess you are looking for something like \autoref provided by package hyperref. You might need to set this up tough, not sure. – Johannes_B Jul 2 '14 at 20:58
• I didn't realize that, I guess my thesis template automatically takes care of that with Figures and Tables. But since Schemes are my own addition, it doesn't do that. If I use \autoref with hyperref instead of \ref, the text references are fixed but the \listofschemes is still missing the "Scheme" label. – MalchiorX Jul 2 '14 at 21:10

This can be done by cleveref and with its \cref/\Cref macros.

\documentclass[letterpaper,12pt]{article}

\usepackage{graphicx}
\usepackage[listformat=simple]{caption}

\DeclareCaptionType[name=Scheme,within=section]{scheme}
\usepackage{cleveref}
\crefname{scheme}{scheme}{schemes}
\Crefname{scheme}{Scheme}{Schemes}
\begin{document}

\tableofcontents

\listofscheme

\newpage

\section{new section}
This is a new section with \cref{sch:1}.
\begin{scheme}
\begin{center}
\caption{\label{sch:1}This is a scheme.}
\rule[-1mm]{8mm}{1cm}
\end{center}
\end{scheme}

\section{Another section}
Testing \cref{sch:2}.
\begin{scheme}
\begin{center}
\caption{\label{sch:2}This is a another scheme.}
\rule[-1mm]{20mm}{1cm}
\end{center}
\end{scheme}

\end{document}


• This will fix the references in text. Do you know how to get the \listofscheme to Say "Scheme 1.1" instead of just "1.1"? – MalchiorX Jul 3 '14 at 1:28
• You could try hacking down your template till you find how it adds the words Figure/table to the respective lists and adapt this to your schemes. – Johannes_B Jul 3 '14 at 6:16
• But think about the reason, that this is not default. What do you expect in a List of figures? Why adding the expected over and over again. – Johannes_B Jul 3 '14 at 6:17
• May be you can provide a link to your template. – user11232 Jul 3 '14 at 8:10
• I will try to find where Figure and Table are added, though looking at the code, it may be a little beyond my skill level. The reason it's not the default is that the template is a work in progress; the programmer was a student and he can't cover all possibilities. While schemes are common in chemistry, they are not common in all sciences. That programmer has graduated, and no one has picked up the work since. Here is a link to the site: template link I am using just the template, not the fully documented version. – MalchiorX Jul 3 '14 at 14:19