浮動和標題邊距混亂

浮動和標題邊距混亂

對於寬浮動,我無法正確對齊標題。我有對頁,經過多次實驗,我最接近成功的是僅適用於奇數頁的正確佈局。

我希望寬圖和標題在頁面上保持對齊。我希望標題的寬度比浮動的寬度小得多。

這是我的 MWE:

\documentclass[openright,twoside]{book}
\usepackage[facing=yes]{floatrow}
\usepackage{caption}
\usepackage{lipsum}
\usepackage{tabulary}

%%
% Set page layout geometry
% The asymmetric option keeps the margin notes always on the same side of the page which is the way Tufte does it.
\RequirePackage[
    letterpaper,
    asymmetric,
    includemp,
    inner=0.5in,
    bindingoffset=1.0in,
    width=6.75in,
    marginparsep=0.25in,
    marginparwidth=2in,
    showframe,
    ] {geometry}

\floatsetup[widefloat]
    {
    floatwidth=6.75in,
    objectset=raggedright,
    }
%
\captionsetup[widefloat]
    {
    margin={0pt,2.25in},
    justification=justified,
    font=small
    }

\begin{document}

\lipsum[2]

\begin{table*}[ht]
    \begin{tabulary}{\linewidth}{|L|l|l|l|l|l|l|}
        \hline
        foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo \\
        \hline
        \end{tabulary}
    \caption{Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit amet,
egestas sed, leo. Praesent feugiat sapien aliquet odio. Integer vitae justo.}
\end{table*}

\clearpage
\lipsum[2]

\begin{table*}[ht]
    \begin{tabulary}{\linewidth}{|L|l|l|l|l|l|l|}
        \hline
        foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo \\
        \hline
        \end{tabulary}
    \caption{Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit amet,
egestas sed, leo. Praesent feugiat sapien aliquet odio. Integer vitae justo.}
\end{table*}

\end{document}

這是我遇到的麻煩(showframe已開啟)。請注意,寬表正確地向左齊平,但標題掛在錯誤的一側。

在此輸入影像描述

- - - 編輯 - - -

據我所知,floatrow有一個左右邊距混合的錯誤。這個駭客使用changepage包撤銷邊距混合:

\newcommand{\widecapfix}
{
    \checkoddpage
    \ifoddpage
        \captionsetup{margin={0in,2.25in}}
    \else
        \captionsetup{margin={2.25in,0in}}
    \fi
}

因此,我必須\widecapfix在標題上方插入每個寬圖的用法。我覺得很噁心。

答案1

如果您願意將表從環境轉換為命令結構,我修改了一個boxhandler套件例程以實現您想要的結果。我必須對命令進行的更改\ReciteTable有兩個:我必須將表格標題放在表格內容之後,而不是之前;我不得不強制標題相對於超大表格左對齊。

\documentclass[openright,twoside]{book}
\usepackage{lipsum}
\usepackage{tabulary}
\usepackage{boxhandler}

%%
% Set page layout geometry
% The asymmetric option keeps the margin notes always on the same side of the page which is the way Tufte does it.
\RequirePackage[
    letterpaper,
    asymmetric,
    includemp,
    inner=0.5in,
    bindingoffset=1.0in,
    width=6.75in,
    marginparsep=0.25in,
    marginparwidth=2in,
    showframe,
    ] {geometry}

\makeatletter
\renewcommand\ReciteTable[6][ht]{%
  \begin{table}[#1]%
    \begin{\LRTablePlacement}%
      \let\@makecaption\new@makecaption%
      \setlength\abovecaptionskip{\arabic{abovecaptionskipterm}\p@}%
      \setlength\belowcaptionskip{\arabic{belowcaptionskipterm}\p@}%
        \set@DataBoxWidth{#3}%
        \setlength\CaptionBoxWidth{#4}%
        \set@BoxOffsets%
        \if T#6%
          \rule{\@DataBoxOffset}{0in}%
          \makebox[\@DataBoxWidth][l]{#5}%
          \rule{\@DataBoxOffset}{0in}\\%
        \fi
        \rule{\@DataBoxOffset}{0in}%
        \usebox{#3}%
        \rule{\@DataBoxOffset}{0in}\\%
        \par%
        \parbox{\CaptionBoxWidth}{\bx@caption{#2}}%
        \rule{\@CaptionBoxOffset}{0em}%
        \rule{\@CaptionBoxOffset}{0em}%
        \if T#6%
          \rule{\@DataBoxOffset}{0in}\\%
          \makebox[\@DataBoxWidth][r]{#5}%
        \rule{\@DataBoxOffset}{0in}%
        \fi
      \let\@makecaption\old@makecaption%
      \setlength\abovecaptionskip \oldabovecaptionskip%
      \setlength\belowcaptionskip \oldbelowcaptionskip%
    \end{\LRTablePlacement}%
  \end{table}%
}
\makeatother

\begin{document}

\lipsum[2]

\constrainCaptionWidth{\textwidth}
\captionStyle{n}{l}
\setlength\TableDeadMargin{0em}

\bxtable[ht]{Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit amet,
egestas sed, leo. Praesent feugiat sapien aliquet odio. Integer vitae justo.}
{%
\normalsize
    \begin{tabulary}{6.75in}{|L|l|l|l|l|l|l|}
        \hline
        foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo \\
        \hline
        \end{tabulary}
}

\clearpage
\lipsum[2]

\bxtable[ht]{Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit amet,
egestas sed, leo. Praesent feugiat sapien aliquet odio. Integer vitae justo.}
{%
\normalsize
    \begin{tabulary}{6.75in}{|L|l|l|l|l|l|l|}
        \hline
        foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo & barbarbar & foofoofoo \\
        \hline
        \end{tabulary}
}

\end{document}

相關內容