# How to define a new lable type such as fig and tab for a new float? [duplicate]

I have define a new float "scheme" and want to reference it as figure or table floats do. How could I define a new label type for the "scheme" float to reference it in the article? I have tried to use fig or tab labels, but they do not work. See the picture.

Tex code:

\documentclass[a4paper, 11pt]{article}
\usepackage{caption}           % Use table caption
\usepackage{chemfig}           % Use chemical strutures
\usepackage{hyperref}

\DeclareCaptionType[fileext=ext, name=Scheme, placement=tbph!]{scheme}
\captionsetup[scheme]{labelsep=period, font={small, bf}, skip=8pt}

\begin{document}
This is a chemical reaction:

\begin{scheme}[h!]
\renewcommand*{\figurename}{scheme}
\centering
\schemestart
\chemfig{*6(-=-=-=)} \+ \chemfig{H_2} \arrow \chemfig{*6(-(-H)=-=(-H)-=)}
\schemestop
\label{sh1}  % define a new label type for scheme float
\caption{Reaction of Benzene Synthesis}
\end{scheme}

A relatively simple, as shown in Scheme~\ref{sh1}, is neutralized by the solution contained within it to form a charged double layer, which under the influence of an applied electric field leads to the electroosmotic mobilization of the solution.

\end{document}

• as always, you need to run latex twice for the cross references to be resolved – David Carlisle Nov 7 '15 at 17:07
• – Werner Nov 7 '15 at 17:08

Place \label after \caption. The \caption macro is the one actually stepping the associated counter which is referred to by \label and \ref. This is the same for figure, table or any newly defined float:

\documentclass[a4paper, 11pt]{article}
\usepackage{caption}           % Use table caption
\usepackage{chemfig}           % Use chemical strutures
\usepackage{hyperref}

\DeclareCaptionType[fileext=ext, name=Scheme, placement=tbph!]{scheme}
\captionsetup[scheme]{labelsep=period, font={small, bf}, skip=8pt}

\begin{document}
This is a chemical reaction:

\begin{scheme}
% \renewcommand*{\figurename}{scheme}
\centering
\schemestart
\chemfig{*6(-=-=-=)} \+ \chemfig{H_2} \arrow \chemfig{*6(-(-H)=-=(-H)-=)}
\schemestop
\caption{Reaction of Benzene Synthesis}
\label{sh1}  % define a new label type for scheme float
\end{scheme}

A relatively simple, as shown in Scheme~\ref{sh1}, is neutralized by the
solution contained within it to form a charged double layer, which under the
influence of an applied electric field leads to the electroosmotic
mobilization of the solution.

\end{document}