2

I am writing a document with margin figures, an environment that comes with sidenotes.

I want to change the caption for those figures, with the caption package. But doing

\usepackage{caption}
\captionsetup[marginfigure]{
labelfont=bf, % for example,
}

doesn't make the caption label in bold, and indeed the log tells me about it:

Package caption Warning: Unused \captionsetup[marginfigure] on input line 6.
See the caption package documentation for explanation.

Is it possible to blend the marginfigure environment with caption?

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{graphicx,sidenotes,caption}
\captionsetup[marginfigure]{
labelfont=bf, % for example,
}
\begin{document}
Lorem ipsum.
\begin{marginfigure}
\includegraphics[width=\marginparwidth]{example-image}
\caption{Caption for the margin figure.}
\end{marginfigure}
\end{document}

enter image description here

tush
  • 1,115

1 Answers1

3
  • I just played with the code and googled a bit.
  • To me, the relationship between the two packages is unclear, at least the manuals do not explain it very well (or I just did not find it).
  • Inspired by Change color for captions in sidenotes and alignment, I came up with the following.
  • To be clear, I do not what I am doing here.

\documentclass{article}

\usepackage{graphicx} \usepackage{caption} \usepackage{sidenotes}

\DeclareCaptionStyle{marginfigure}{labelfont=bf}

\begin{document}

Lorem ipsum.

\begin{marginfigure} \includegraphics[width=\marginparwidth]{example-image} \caption{Caption for the margin figure.} \end{marginfigure}

\end{document}

enter image description here


enter image description here Taken from the sidenotes manual.

enter image description here Taken from the caption manual.