# knitr Caption figure without number

I am looking for a way to caption my figures without numbering them (like \caption*{}). I am not sure how to do this in knitr.

The following example shows my first attempt:

<<label, include=TRUE, fig.pos='htb', fig.align='center',
fig.cap='nice figure', fig.width=6, fig.height=3, tidy=TRUE>>=

plot(1:10, 1:10)
@


Thanks!

• For all figures, or just select ones? – Werner Jul 23 '15 at 23:38

For anyone stumbling on this. This works specifically for knitr as follows, using the working example provided:

\documentclass{article}
\usepackage{caption}
\begin{document}

\captionsetup{labelformat=empty}
<<label, include=TRUE, fig.pos='htb', fig.align='center', fig.cap='nice figure', fig.width=6, fig.height=3, tidy=TRUE>>=
plot(1:10, 1:10)
@
\captionsetup{labelformat=default}

\end{document}


try to use \captionsetup from the package caption that way:

\documentclass{article}
\usepackage{caption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h!]
\centering
\includegraphics[height=2cm]{figure}
\caption{Une figure.}
\end{figure}

\begin{figure}[h!]
\centering
\includegraphics[height=2cm]{figure1}
\captionsetup{labelformat=empty}
\caption{Une figure.}
\end{figure}
\end{document}

• How do i use this for knitr? For the example I have in my question – tallharish Jul 24 '15 at 18:40