2

I find that \caption* behaves strangely for non-margin figures in tufte-book. I'm using the caption package. For margin figures, \caption* properly suppresses the figure number at the beginning of the caption. For non-margin figures the figure number appears, follwed by "*" as the caption, and then the actual caption text is appended directly under the figure as though it were part of the figure. Here's an example:

\documentclass{tufte-book}
\usepackage{caption}
\captionsetup{compatibility=false}
\usepackage{lipsum}
\usepackage{mwe}

\begin{document}

\section{This section}

\begin{marginfigure}
\centering
\includegraphics[width=\textwidth]{example-image-a}
\caption*{This is a margin caption.}
\end{marginfigure}

\lipsum[1]

\begin{figure*}
\includegraphics[width=\textwidth]{example-image-b}
\caption*{This is a main caption.}
\end{figure*}

\end{document}

John Kormylo's answer below doesn't quite do the trick. It does eliminate the figure number, but it places the caption below the figure instead of "tuftily" placing it to the side. See for example the two side-by-side images below:

The left-hand image was made using the \setcaption trick. The right-hand image is the default way tufte-book renders a \caption.

1

1 Answer 1

0

Both \caption and \@makecaption get replaced frequently. \setcaption restores them.

\documentclass{tufte-book}
\usepackage{caption}
\captionsetup{compatibility=false}
\makeatletter
\newcommand\setcaption{% use caption package \caption
  \let\@makecaption=\caption@makecaption
  \let\caption=\caption@caption
}
\makeatother
\usepackage{lipsum}
\usepackage{mwe}

\begin{document}

\section{This section}

\begin{marginfigure}
\centering
\includegraphics[width=\textwidth]{example-image-a}
\setcaption
\caption*{This is a margin caption.}
\end{marginfigure}

\lipsum[1]

\begin{figure*}
\includegraphics[width=\textwidth]{example-image-b}
\setcaption
\caption*{This is a main caption.}
\end{figure*}

\end{document}

It would be difficult, if not impossible, to modify \tufte@caption to handle a caption package \caption. However, you can always overlap the marginpar area, which is what \tuftestuff does (feel free to rename it).

I would have used the marginnotes package, but that is also incompatible with tufte.

\documentclass{tufte-book}
\usepackage{caption}
\captionsetup{compatibility=false}
\makeatletter
\newcommand\setcaption{% use caption package \caption
  \let\@makecaption=\caption@makecaption
  \let\caption=\caption@caption
}
\makeatother
\usepackage{lipsum}
\usepackage{graphicx}

\newcommand{\tuftestuff}[1]{% #1 = \caption
  \setcaption
  \rlap{\hskip\textwidth\hskip\marginparsep\smash{\parbox[t]{\marginparwidth}{#1}}}%
}

\begin{document}

\section{This section}

\begin{marginfigure}
\centering
\includegraphics[width=\textwidth]{example-image-a}
\setcaption
\caption*{This is a margin caption.}
\end{marginfigure}

\lipsum[1]

\begin{figure}
\tuftestuff{\caption*{This is a main caption.}}% must go first
\includegraphics[width=\textwidth]{example-image-b}
\end{figure}

\begin{figure*}
\includegraphics[width=\textwidth]{example-image-b}
\setcaption
\caption*{This is a main caption.}
\end{figure*}

\end{document}
1
  • This doesn't seem to quite do it. See the comments and image I added to the bottom of the original post. Jun 24, 2020 at 16:43

You must log in to answer this question.

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