2

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!

1
  • For all figures, or just select ones?
    – Werner
    Commented Jul 23, 2015 at 23:38

2 Answers 2

4

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}
0

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}
1
  • 1
    How do i use this for knitr? For the example I have in my question
    – tallharish
    Commented Jul 24, 2015 at 18:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .