我threeparttable
在memoir
文档中有一个,我希望最多从文本块的内边距延伸到边注的外边距。我还希望表格从奇数页的内边距开始,并在奇数页的内边距结束。
tabulary
我认为和的结合floatrow
的组合会给我带来这个,因此我编造了以下内容,不幸的是一点也不我想要的。很明显,表格的起始位置不是我想要的。我怀疑宽度也不对。而且,也许最不明显的是,第二个表格的标题似乎与其表格的宽度不一样。
我应该怎么做呢?我尝试阅读floatrow
文档,但关于这个主题的内容很少。
\documentclass[twoside]{memoir}
\usepackage{showframe}
\usepackage{threeparttable}
\let\newfloat\undefined% [Fix error loading `floatrow` with `memoir`](https://tex.stackexchange.com/a/246918/71332)
\usepackage{floatrow}
\usepackage{calc}
\newlength{\maxfloatwidth}
\setlength{\maxfloatwidth}{\textwidth+\marginparsep+\marginparwidth}% Ought to be the length from the text block's inner margin to the outer margin of the margin notes
\usepackage{tabulary}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{blindtext}
\begin{document}
\Blindtext[3]
\thisfloatsetup{margins=hangoutside}
\begin{table}[t]
\begin{floatrow}
\ttabbox{\caption{A table heading that goes on and on and on and on and on and on and on and on and on and on}}{\begin{threeparttable}
\begin{tabulary}{\maxfloatwidth}{@{} L c c c @{}}
\toprule
A & B & C & D \tabularnewline
\midrule
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a & 123 & 456 & 789 \tabularnewline
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a & 123 & 456 & 789 \tabularnewline
\bottomrule
\end{tabulary}
\begin{tablenotes}
\item[a] \blindtext
\end{tablenotes}
\end{threeparttable}}
\end{floatrow}
\end{table}
\Blindtext[5]
\thisfloatsetup{margins=hangoutside}
\begin{table}[t]
\begin{floatrow}
\ttabbox{\caption{A table heading that goes on and on and on and on and on and on and on and on and on and on}}{\begin{threeparttable}
\begin{tabulary}{1.2\linewidth}{@{} L c c c @{}}
\toprule
A & B & C & D \tabularnewline
\midrule
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a & 123 & 456 & 789 \tabularnewline
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a & 123 & 456 & 789 \tabularnewline
\bottomrule
\end{tabulary}
\begin{tablenotes}
\item[a] \blindtext
\end{tablenotes}
\end{threeparttable}}
\end{floatrow}
\end{table}
\Blindtext[5]
\end{document}
答案1
这是一个使用的解决方案adjustwidth*
。请注意,不再需要使用该calc
包。并且memoir
有类似的showframe
内置功能。
\documentclass[twoside]{memoir}
\usepackage{threeparttable}
\newlength{\maxfloatwidth}
\setlength{\maxfloatwidth}{\dimexpr\textwidth+\marginparsep+\marginparwidth}%
\usepackage{tabulary}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{blindtext}
\pagestyle{showlocs} % similar to showframe
%\strictpagecheck
\begin{document}
\Blindtext[3]
\begin{table}[t]
\begin{adjustwidth*}{0pt}{\dimexpr-\marginparsep-\marginparwidth\relax}
\begin{threeparttable}
\caption{A table heading that goes on and on and on and on and on and on and on and on and on and on}
\begin{tabulary}{\maxfloatwidth}{@{} L c c c @{}}
\toprule A & B & C & D \tabularnewline \midrule a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a & 123 & 456
& 789 \tabularnewline a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a & 123 & 456 & 789 \tabularnewline
\bottomrule
\end{tabulary}
\begin{tablenotes}
\item[a] \blindtext
\end{tablenotes}
\end{threeparttable}
\end{adjustwidth*}
\end{table}
\Blindtext[5]
\begin{table}[t]
\begin{adjustwidth*}{0pt}{\dimexpr-\marginparsep-\marginparwidth\relax}
\begin{threeparttable}
\caption{A table heading that goes on and on and on and on and on and on and on and on and on and on}
\begin{tabulary}{\maxfloatwidth}{@{} L c c c @{}}
\toprule A & B & C & D \tabularnewline \midrule a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a & 123 & 456
& 789 \tabularnewline a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a & 123 & 456 & 789 \tabularnewline
\bottomrule
\end{tabulary}
\begin{tablenotes}
\item[a] \blindtext
\end{tablenotes}
\end{threeparttable}
\end{adjustwidth*}
\end{table}
\Blindtext[5]
\end{document}
答案2
与 @daleif 的回答非常相似 (+1),但我宁愿使用包而不是和包。使用threeparttable
它,表代码更短,表看起来也更好一些:tabulary
talltblr
tabularray
\documentclass[twoside]{memoir}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\usepackage{lipsum}
\pagestyle{showlocs} % similar to showframe
\strictpagecheck % <---
\begin{document}
\chapter{Very important chapter}
\lipsum[1-3]
\section{Section with wide table}
\lipsum[4]
\begin{table}[ht]
\begin{adjustwidth*}{0pt}{-\dimexpr\marginparsep+\marginparwidth\relax}
\begin{talltblr}[
caption = {A table heading that goes on and on and on and on and on and on and on and on and on and on},
label = {tab:talltblr},
note{a} = {\lipsum[66]},
]{colspec = {@{} X[j] c c c @{}}}
\toprule
A & B & C & D \\
\midrule
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
& 123 & 456 & 789 \\
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
& 123 & 456 & 789 \\
\bottomrule
\end{talltblr}
\end{adjustwidth*}
\end{table}
\lipsum[5]
\end{document}
答案3
我不确定为什么要使用floatrow
。如果您的目的是让奇数页上的大浮动元素贴在右侧,而偶数页上的浮动元素贴在右侧,则可以使用adjustwidth
(内置于memoir
)。
\documentclass[twoside]{memoir}
\usepackage{threeparttable}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{ifoddpage}
\usepackage{blindtext}
\usepackage{showframe}
\begin{document}
\Blindtext[3]
\begin{table}[htp]
\checkoddpage
\begin{adjustwidth}
{-\ifoddpage 0pt\else\dimeval{\marginparsep+\marginparwidth}\fi}
{-\ifoddpage\dimeval{\marginparsep+\marginparwidth}\else 0pt\fi}
\begin{threeparttable}
\caption{A table heading that goes on and on and on and on
and on and on and on and on and on and on}
\begin{tabularx}{\dimeval{\textwidth+\marginparsep+\marginparwidth}}{@{} X c c c @{}}
\toprule
A & B & C & D \tabularnewline
\midrule
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a a & 123 & 456 & 789 \tabularnewline
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a a & 123 & 456 & 789 \tabularnewline
\bottomrule
\end{tabularx}
\begin{tablenotes}
\item[a] \blindtext
\end{tablenotes}
\end{threeparttable}
\end{adjustwidth}
\end{table}
\Blindtext[5]
\begin{table}[htp]
\checkoddpage
\begin{adjustwidth}
{-\ifoddpage 0pt\else\dimeval{\marginparsep+\marginparwidth}\fi}
{-\ifoddpage\dimeval{\marginparsep+\marginparwidth}\else 0pt\fi}
\begin{threeparttable}
\caption{A table heading that goes on and on and on and on
and on and on and on and on and on and on}
\begin{tabularx}{\dimeval{\textwidth+\marginparsep+\marginparwidth}}{@{} X c c c @{}}
\toprule
A & B & C & D \tabularnewline
\midrule
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a a & 123 & 456 & 789 \tabularnewline
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a a & 123 & 456 & 789 \tabularnewline
\bottomrule
\end{tabularx}
\begin{tablenotes}
\item[a] \blindtext
\end{tablenotes}
\end{threeparttable}
\end{adjustwidth}
\end{table}
\Blindtext[5]
\end{document}
两者都不需要tabulary
。