9

In a long paper, full of figures labeled as usual, there are two figures which I would like to single out and label with symbols. For instance, I would like to have them labeled Figure $\dag$ and Figure $\ddag$. I would like to do this in a way that is compatible with \label and \ref, so that when I refer to Figure $\dag$ \label{dagfig} with \ref{dagfig}, I get $\dag$. I would also like the figures to appear with this labeling in the list of figures. Is there some way to do this?

9

You can redefine \thefigure locally and step down the figure counter:

\documentclass{article}

\begin{document}

\listoffigures

\begin{figure}
\renewcommand\thefigure{$\dag$}
\caption{Figure dag}
\label{fig:dag}
\addtocounter{figure}{-1}
\end{figure}

\begin{figure}
\renewcommand\thefigure{$\ddag$}
\caption{Figure ddag}
\label{fig:ddag}
\addtocounter{figure}{-1}
\end{figure}

Figures~\ref{fig:dag}, and~\ref{fig:ddag}...

\begin{figure}
\caption{Regular figure}
\label{fig:fig}
\end{figure}

\end{document}

enter image description here

egreg has suggested a refinement to the above solution using a new command:

\documentclass{article}

\makeatletter
\newcommand\specialcaption[1]{%
  \@namedef{the\@captype}{#1}%
  \addtocounter{\@captype}{-1}\caption}
\makeatother

\begin{document}

\begin{figure}
\specialcaption{$\dag$}{Figure dag}
\label{fig:dag}
\end{figure}

\begin{figure}
\specialcaption{$\ddag$}{Figure ddag}
\label{fig:ddag}
\end{figure}

Figures~\ref{fig:dag}, and~\ref{fig:ddag}...

\begin{figure}
\caption{Regular figure}
\label{fig:fig}
\end{figure}

\end{document}

\specialcaption also admits the optional argument, as in

\specialcaption{$\dag$}[short]{long}

and, since it uses \@captype, this command can also be used in the table environment. Usual precautions about using fragile commands also apply to \specialcaption.

  • Gonzalo, look in the chat. – egreg Jun 11 '12 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.