0

To work around the problem of inserting two figures inside a single one, each taking up the whole page, I chose to insert two successive figures by assigning a caption and a label only to one between them. The Documentclass is Tufte-book, in which the largetable and largefigure have been redefined as it is presented below in the MWE. However, the layout of the second figure is not good when inserted after the first (while it is good when taken in isolation) since it is shifted into the left margin. The current result is shown in the image below, with the corresponding MWE. What correction should I make to correct this problem?

Layout problem of two successive largefigure

\documentclass[a4paper,nobib,twoside,symmetric,justified,marginals=raggedouter]{tufte-book}
\makeatletter
\newlength{\oddshift}
\newcommand{\captionatbottommargin}{% from https://tex.stackexchange.com/a/229419/161015
\long\def\@caption##1[##2]##3{%
\par
\addcontentsline{\csname ext@##1\endcsname}{##1}%
{\protect\numberline{\csname the##1\endcsname}{\ignorespaces ##2}}%
\begingroup
\@parboxrestore%
\if@minipage\@setminipage\fi%
\normalsize
\@makecaption{\csname fnum@##1\endcsname}{\ignorespaces ##3}\par
\endgroup}
\long\def\@makecaption##1##2{%
\vskip\abovecaptionskip%
\@tufte@checkoddpage%
\ifthenelse{\boolean{@tufte@odd@page}}%
{\setlength{\oddshift}{\linewidth+\marginparsep}\rlap{\hskip\oddshift\parbox{\marginparwidth} 
{\hskip0pt\@tufte@caption@font##1: ##2}}}%
{\setlength{\oddshift}{-\marginparwidth- 
\marginparsep}\rlap{\hskip\oddshift\parbox{\marginparwidth}{\@tufte@caption@font##1: ##2}}}%
\vskip\belowcaptionskip%
}%
\let\caption\@tufte@orig@caption%
\let\label\@tufte@orig@label}

\newenvironment{largetable}{% @tufte@checkoddpage% \ifthenelse{\boolean{@tufte@odd@page}}% {\begin{table}[!htbp]\vspace{-3ex}\begin{adjustwidth}{}{-\marginparwidth- \marginparsep}\captionatbottommargin}% {\begin{table}[!htbp]\vspace{-3ex}\begin{adjustwidth}{-\marginparwidth-\marginparsep} {}\captionatbottommargin}}
{\end{adjustwidth}\end{table}}

\newenvironment{largefigure}{% @tufte@checkoddpage% \ifthenelse{\boolean{@tufte@odd@page}}% {\begin{figure}[htbp!]\vspace{-3ex}\begin{adjustwidth}{}{-\marginparwidth- \marginparsep}\captionatbottommargin}%changed <<<<<< {\begin{figure}[htbp!]\vspace{-3ex}\begin{adjustwidth}{-\marginparwidth-\marginparsep} {}\captionatbottommargin}}
{\end{adjustwidth}\end{figure}}

\makeatother

\begin{document} \newpage \begin{largefigure} \checkoddpage \ifoddpage \forcerectofloat \else \forceversofloat \fi \includegraphics[width=\linewidth,rotate=180]{example-figure1.pdf}% \forceversofloat \end{largefigure}

\newpage \begin{largefigure} \includegraphics[width=\linewidth,rotate=180]{example-figure2.pdf}% \caption{Caption title.}% \label{fig:Figure 1}% \end{largefigure}

\end{document}

Phil8544
  • 407
  • Is this a followup or duplicate to https://tex.stackexchange.com/q/669989 ? If so, maybe that one should be closed. – barbara beeton Dec 29 '22 at 19:36
  • @barbarabeeton yes the two questions are relative to the same problem. This one is a followup of tex.stackexchange.com/q/669989... The former could be closed if you want, even if your comment is interesting (but I didn't find the solution to my problem...) – Phil8544 Dec 29 '22 at 19:54
  • Tufte deliberated extends the \largefigure into the marginpar area, which alternates left for even pages and right for odd pages. Try adding [oneside] to the \documentclass options (which should make every page odd). There are othe ways to overlap the margins, such as \makebox[\textwidth]{...}. – John Kormylo Dec 30 '22 at 14:14

1 Answers1

0

I solved the problem by modifying the code in the second figure as shown below (I don't know if it's a very "elegant" way, but it works):

\documentclass[a4paper,nobib,twoside,symmetric,justified,marginals=raggedouter]{tufte-book}

\begin{document} \newpage \begin{largefigure} \checkoddpage \ifoddpage \forcerectofloat \else \forceversofloat \fi \includegraphics[width=\linewidth,rotate=180]{example-figure1.pdf}% \forceversofloat \end{largefigure}

\newpage \begin{largefigure} \hspace*{3.70cm}\includegraphics[width=\linewidth,rotate=180]{example-figure2.pdf}\% \caption{Caption title.}% \label{fig:Figure 1}% \end{largefigure}

\end{document}

Phil8544
  • 407