# tufte-book marginfigure overlaps full-width content

\documentclass[nobib]{tufte-book}
\usepackage{mwe}
% avoid line breaks in inline math
% https://tex.stackexchange.com/a/14243/
\relpenalty=9999
\binoppenalty=9999

\begin{document}
\mainmatter

Some text, but less than the height of the margin figure.

\begin{marginfigure}
\includegraphics[width=1.0\textwidth]{example-image}
\caption{The caption of the figure}
\end{marginfigure}

\begin{figure*}
\begin{center}
\includegraphics[width=0.23\textwidth]{example-image}
\includegraphics[width=0.23\textwidth]{example-image}
\includegraphics[width=0.23\textwidth]{example-image}
\includegraphics[width=0.23\textwidth]{example-image}
\end{center}
\caption{Another caption}
\end{figure*}

\end{document}

produces

I am looking for a suggestion to avoid the overlap in the figures. I am hoping there's a solution that does not involve adding a fixed amount of vertical space, but something that would adapt to the situation where there is enough text to not require any blank vertical space.

I tried \usepackage{marginfix} without success.

• I would be very surprised, if there was an automatic solution, so you should compose your text carefully in order to avoid overlapping. You probably have to specify an offset with \begin{marginfigure}[⟨offset⟩], cf. ctan.org/pkg/tufte-latex?lang=en
– DG'
May 21, 2021 at 21:40

First option: place the text line inside a minipage of adequate height to keep it aligned with the figure in the margin:

\begin{minipage}[c][4cm][c]{\textwidth}
Some text, but less than the height of the margin figure.
\end{minipage}

Second option: send the figure* to the top of the page using as float position specifier [!]

\documentclass[nobib]{tufte-book}
\usepackage{graphicx}
% avoid line breaks in inline math
% https://tex.stackexchange.com/a/14243/
\relpenalty=9999
\binoppenalty=9999

\begin{document}
\mainmatter

Some text, but less than the height of the margin figure.

\begin{marginfigure}
\includegraphics[width=\marginparwidth]{example-image-a}
\caption{The caption of the figure}
\end{marginfigure}

\begin{figure*}[!]
\centering
\includegraphics[width=0.23\textwidth]{example-image}
\includegraphics[width=0.23\textwidth]{example-image}
\includegraphics[width=0.23\textwidth]{example-image}
\includegraphics[width=0.23\textwidth]{example-image}
\caption{Another caption}
\end{figure*}
\end{document}