[Tex/LaTex] Suppressing figure numbers in wrapfig

captionswrapfigure

Like @brannerchinese here, I'd like to suppress the figure numbers for certain figures, but I'd like to do it within the context of the wrapfig and wrapfigure package/environment.

Being rather new at this, I don't really understand the answer that @GonzaloMedina gave him, so I can't generalize that, but I did try blindly copying and pasting the \newcommand\WLcaption[1]{ (et. al.) into my preamble just in case, and as I guessed, it didn't work (compile failed with error). Also tried \caption*{text} in case that had been implemented for wrapfig but also no joy.

Any ideas on how to do this? I just want a caption for some figures, but no figure numbers.

Best Answer

The following code shows three options, all of them using features provided by the caption package: the first one, uses \caption*; the second one uses \captionsetup to declare the predefined labelformat=empty style to suppress the label; the third option uses \DeclareCaptionLabelFormat to define a caption format without number but keeping the "Figure" label:

\documentclass{article}
\usepackage{wrapfig}
\usepackage{caption}
\usepackage{lipsum}

\DeclareCaptionLabelFormat{nonumber}{#1}

\begin{document}
\begin{wrapfigure}{r}{3cm}
\centering
\rule{2cm}{2cm}
\caption*{Test figure}
\end{wrapfigure}
\lipsum[1]
\begin{wrapfigure}{r}{3cm}
\centering
\captionsetup{labelformat=empty}
\rule{2cm}{2cm}
\caption{Test figure}
\end{wrapfigure}
\lipsum[1]
\begin{wrapfigure}{r}{3cm}
\centering
\captionsetup{labelformat=nonumber}
\rule{2cm}{2cm}
\caption{Test figure}
\end{wrapfigure}
\lipsum[1]
\end{document} 

enter image description here