2个连续大图形的布局问题

2个连续大图形的布局问题

为了解决在一个图形中插入两个图形而每个图形都占据整个页面的问题,我选择插入两个连续的图形,并只为它们之间的一个图形分配标题和标签。Documentclass 是 Tufte-book,其中的 largetable 和 largefigure 已被重新定义,如下面 MWE 中所示。但是,第二个图形插入第一个图形之后时布局不好(单独看时布局很好),因为它移到了左边距。当前结果如下图所示,带有相应的 MWE。我应该做什么修正来纠正这个问题?

两个连续大图形的布局问题

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

答案1

我通过修改第二张图中的代码解决了这个问题,如下所示(我不知道这是否是一种非常“优雅”的方式,但它确实有效):

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

相关内容