我有一个相当大的表格threeparttable
,它太宽了,无法放在垂直页面上,所以我把它放在了页面上landscape
。但现在它有点太高了,无法放在顶部(左)和底部(右)边距之间,并且会延伸到下部(右?)边距。我想要的是垂直对齐表格,以便它均匀地延伸到顶部和底部边距(或者最好取决于hmarginratio
,我现在设置为,但对于打印版本1:1
将更改为)。2:3
之前,我设法通过newgeometry
为横向页面设置来解决此问题,但是这会移动我的fancehdr
,我想将其保持在原来的位置,以便在阅读打印的文档时它不会移动。
我也尝试过调整设置adjustbox
,但无法解决我的问题。大多数类似的问题似乎都集中在表格高度低于文本高度的问题上。
以下是 MWE:
\documentclass[12pt,twoside,english]{article}
\usepackage[a4paper,
width=16cm, %bindingoffset=-1mm,
hmarginratio=1:1, % default=2:3
top=25mm,bottom=25mm,headheight=12mm%,showframe
]{geometry}
\usepackage{pdflscape}
\usepackage[export]{adjustbox}
\usepackage[referable]{threeparttablex}
\usepackage{booktabs}
\usepackage{etoolbox}
\appto\TPTnoteSettings{\footnotesize}
\setlength{\defaultaddspace}{2pt}
\usepackage[format=default,justification=justified,labelfont=bf,font=small,skip=0pt]{caption}
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[CE]{\textit{Author}}
\fancyhead[RE]{}
\fancyhead[LO]{}
\fancyhead[CO]{\textit{Title}}
\fancyhead[RO]{\thepage}
\pagestyle{fancy}
\begin{document}
This text should be on a normal page.
\begin{landscape}
\begin{table}[h!]
\begin{adjustbox}{valign=C,raise=2cm}
\centering
\begin{threeparttable}
\caption{A long caption that spans multiple lines, so it adds considerable height tot the total table height. This makes is even more important to center the table vertically as the bottom of the tbale comes very close to the bottom of the page. This does not look good when printing the document on paper.}
\begin{tabular}{ccccccccccccc}
\toprule
\multicolumn{ 1}{c}{\em } & \multicolumn{12}{c}{\em Spanner head} \\
\cmidrule(l){2-13}
\multicolumn{1}{c}{ } & \multicolumn{6}{c}{Left panel} & \multicolumn{6}{c}{Right panel} \\
\cmidrule(lr){2-7} \cmidrule(l){8-13}
${k}$ & ${Column 1}$ & ${Column2}$ & ${Column3}$ & ${Column4\tnote{a}}$ & ${Column5}$ & ${Column6\tnote{c}}$ & ${Col.1}$ & ${Col.2}$ & ${Col.3}$ & ${Col.4\tnote{a}}$ & ${Col.5}$ & ${Col.6\tnote{c}}$\\
\midrule
1 & 2.45$^{**}$ & 1.28$^{**}$ & -0.33$^{**}$ & 0.06 & 3.41 & 8.49$^{**}$ & 2.45$^{**}$ & 1.28$^{**}$ & -0.33$^{**}$ & 0.06 & 3.41 & 8.49$^{**}$\\
& (0.40) & (0.39) & (0.12) & & & & (0.40) & (0.39) & (0.12) & & & \\
\addlinespace
2 & 2.29$^{**}$ & 1.55$^{**}$ & -0.40$^{**}$ & 0.13 & 2.65 & 20.42$^{**}$ & 2.20$^{**}$ & 1.79$^{**}$ & -0.47$^{**}$ & 0.12 & 3.30 & 17.51$^{**}$\\
& (0.44) & (0.36) & (0.11) & & & & (0.36) & (0.36) & (0.12) & & & \\
\addlinespace
3 & 2.26$^{**}$ & 1.51$^{**}$ & -0.38$^{**}$ & 0.16 & 2.32 & 25.39$^{**}$ & 2.26$^{**}$ & 1.40$^{**}$ & -0.33$^{*}$ & 0.07 & 3.38 & 10.80$^{**}$\\
& (0.45) & (0.35) & (0.11) & & & & (0.41) & (0.44) & (0.14) & & & \\
\addlinespace
4 & 2.25$^{**}$ & 1.44$^{**}$ & -0.36$^{**}$ & 0.18 & 2.09 & 29.38$^{**}$ & 2.29$^{**}$ & 1.23 & -0.27 & 0.06 & 3.41 & 8.52$^{**}$\\
& (0.58) & (0.33) & (0.12) & & & & (0.50) & (0.68) & (0.22) & & & \\
\addlinespace
5 & 2.28$^{**}$ & 1.37$^{**}$ & -0.34$^{**}$ & 0.19 & 1.92 & 31.36$^{**}$ & 2.49$^{**}$ & 1.05$^{**}$ & -0.25$^{*}$ & 0.04 & 3.44 & 5.78$^{**}$\\
& (0.56) & (0.33) & (0.12) & & & & (0.52) & (0.38) & (0.12) & & & \\
\addlinespace
6 & 2.34$^{**}$ & 1.24$^{**}$ & -0.30$^{**}$ & 0.19 & 1.79 & 29.83$^{**}$ & 2.71$^{**}$ & 0.57$^{*}$ & -0.12 & 0.01 & 3.50 & 1.80\\
& (0.58) & (0.30) & (0.11) & & & & (0.53) & (0.27) & (0.10) & & & \\
\addlinespace
7 & 2.40$^{**}$ & 1.13$^{**}$ & -0.27$^{*}$ & 0.18 & 1.69 & 27.62$^{**}$ & 2.83$^{**}$ & 0.40 & -0.09 & 0.00 & 3.52 & 0.88\\
& (0.63) & (0.28) & (0.11) & & & & (0.57) & (0.36) & (0.11) & & & \\
\addlinespace
8 & 2.48$^{**}$ & 1.03$^{**}$ & -0.25$^{*}$ & 0.16 & 1.61 & 25.02$^{**}$ & 3.07$^{**}$ & 0.27 & -0.11 & 0.00 & 3.52 & 0.44\\
& (0.65) & (0.26) & (0.10) & & & & (0.62) & (0.72) & (0.21) & & & \\
\addlinespace
12 & 2.77$^{**}$ & 0.61 & -0.17 & 0.08 & 1.40 & 11.03$^{**}$ & 3.37$^{**}$ & -0.26 & 0.02 & 0.01 & 2.33 & 1.76\\
& (0.78) & (0.48) & (0.15) & & & & (1.15) & (1.07) & (0.29) & & & \\
\addlinespace
16 & 2.96$^{**}$ & 0.31 & -0.09 & 0.02 & 1.25 & 3.46$^{*}$ & 3.57$^{**}$ & -0.66 & 0.13 & 0.04 & 2.24 & 5.99$^{**}$\\
& (1.09) & (0.36) & (0.16) & & & & (0.78) & (0.41) & (0.15) & & & \\
\addlinespace
20 & 3.08$^{**}$ & 0.17 & -0.07 & 0.01 & 1.13 & 1.89 & 3.55$^{**}$ & -0.41 & 0.02 & 0.03 & 2.20 & 5.25$^{**}$\\
& (0.97) & (0.35) & (0.15) & & & & (0.79) & (0.43) & (0.15) & & & \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\item \textit{Notes:}
\item A general note.
\item[a] A specific note.
\item[b] Another specific note.
\item[c] The last note.
\end{tablenotes}
\end{threeparttable}
\end{adjustbox}
\end{table}
\end{landscape}
Here the normal page orientation continues.
\end{document}
答案1
这几乎是一行补丁。我过去\raisebox
将基线和\smash
表格居中,以便 [p] 可以将基线置于页面中央。
\documentclass[12pt,twoside,english]{article}
\usepackage[a4paper,
width=16cm, %bindingoffset=-1mm,
hmarginratio=1:1, % default=2:3
top=25mm,bottom=25mm,headheight=12mm%,showframe
]{geometry}
\usepackage{pdflscape}
\usepackage[export]{adjustbox}
\usepackage[referable]{threeparttablex}
\usepackage{booktabs}
\usepackage{etoolbox}
\appto\TPTnoteSettings{\footnotesize}
\setlength{\defaultaddspace}{2pt}
\usepackage[format=default,justification=justified,labelfont=bf,font=small,skip=0pt]{caption}
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[CE]{\textit{Author}}
\fancyhead[RE]{}
\fancyhead[LO]{}
\fancyhead[CO]{\textit{Title}}
\fancyhead[RO]{\thepage}
\pagestyle{fancy}
\newlength{\tempdima}% name is unimportant
\begin{document}
This text should be on a normal page.
\begin{landscape}
\begin{table}[p]
\centering
\raisebox{\dimexpr 0.5\depth-0.5\height}[0pt][0pt]{\begin{threeparttable}
\caption{A long caption that spans multiple lines, so it adds considerable height tot the total table height. This makes is even more important to center the table vertically as the bottom of the tbale comes very close to the bottom of the page. This does not look good when printing the document on paper.}
\begin{tabular}{ccccccccccccc}
\toprule
\multicolumn{ 1}{c}{\em } & \multicolumn{12}{c}{\em Spanner head} \\
\cmidrule(l){2-13}
\multicolumn{1}{c}{ } & \multicolumn{6}{c}{Left panel} & \multicolumn{6}{c}{Right panel} \\
\cmidrule(lr){2-7} \cmidrule(l){8-13}
${k}$ & ${Column 1}$ & ${Column2}$ & ${Column3}$ & ${Column4\tnote{a}}$ & ${Column5}$ & ${Column6\tnote{c}}$ & ${Col.1}$ & ${Col.2}$ & ${Col.3}$ & ${Col.4\tnote{a}}$ & ${Col.5}$ & ${Col.6\tnote{c}}$\\
\midrule
1 & 2.45$^{**}$ & 1.28$^{**}$ & -0.33$^{**}$ & 0.06 & 3.41 & 8.49$^{**}$ & 2.45$^{**}$ & 1.28$^{**}$ & -0.33$^{**}$ & 0.06 & 3.41 & 8.49$^{**}$\\
& (0.40) & (0.39) & (0.12) & & & & (0.40) & (0.39) & (0.12) & & & \\
\addlinespace
2 & 2.29$^{**}$ & 1.55$^{**}$ & -0.40$^{**}$ & 0.13 & 2.65 & 20.42$^{**}$ & 2.20$^{**}$ & 1.79$^{**}$ & -0.47$^{**}$ & 0.12 & 3.30 & 17.51$^{**}$\\
& (0.44) & (0.36) & (0.11) & & & & (0.36) & (0.36) & (0.12) & & & \\
\addlinespace
3 & 2.26$^{**}$ & 1.51$^{**}$ & -0.38$^{**}$ & 0.16 & 2.32 & 25.39$^{**}$ & 2.26$^{**}$ & 1.40$^{**}$ & -0.33$^{*}$ & 0.07 & 3.38 & 10.80$^{**}$\\
& (0.45) & (0.35) & (0.11) & & & & (0.41) & (0.44) & (0.14) & & & \\
\addlinespace
4 & 2.25$^{**}$ & 1.44$^{**}$ & -0.36$^{**}$ & 0.18 & 2.09 & 29.38$^{**}$ & 2.29$^{**}$ & 1.23 & -0.27 & 0.06 & 3.41 & 8.52$^{**}$\\
& (0.58) & (0.33) & (0.12) & & & & (0.50) & (0.68) & (0.22) & & & \\
\addlinespace
5 & 2.28$^{**}$ & 1.37$^{**}$ & -0.34$^{**}$ & 0.19 & 1.92 & 31.36$^{**}$ & 2.49$^{**}$ & 1.05$^{**}$ & -0.25$^{*}$ & 0.04 & 3.44 & 5.78$^{**}$\\
& (0.56) & (0.33) & (0.12) & & & & (0.52) & (0.38) & (0.12) & & & \\
\addlinespace
6 & 2.34$^{**}$ & 1.24$^{**}$ & -0.30$^{**}$ & 0.19 & 1.79 & 29.83$^{**}$ & 2.71$^{**}$ & 0.57$^{*}$ & -0.12 & 0.01 & 3.50 & 1.80\\
& (0.58) & (0.30) & (0.11) & & & & (0.53) & (0.27) & (0.10) & & & \\
\addlinespace
7 & 2.40$^{**}$ & 1.13$^{**}$ & -0.27$^{*}$ & 0.18 & 1.69 & 27.62$^{**}$ & 2.83$^{**}$ & 0.40 & -0.09 & 0.00 & 3.52 & 0.88\\
& (0.63) & (0.28) & (0.11) & & & & (0.57) & (0.36) & (0.11) & & & \\
\addlinespace
8 & 2.48$^{**}$ & 1.03$^{**}$ & -0.25$^{*}$ & 0.16 & 1.61 & 25.02$^{**}$ & 3.07$^{**}$ & 0.27 & -0.11 & 0.00 & 3.52 & 0.44\\
& (0.65) & (0.26) & (0.10) & & & & (0.62) & (0.72) & (0.21) & & & \\
\addlinespace
12 & 2.77$^{**}$ & 0.61 & -0.17 & 0.08 & 1.40 & 11.03$^{**}$ & 3.37$^{**}$ & -0.26 & 0.02 & 0.01 & 2.33 & 1.76\\
& (0.78) & (0.48) & (0.15) & & & & (1.15) & (1.07) & (0.29) & & & \\
\addlinespace
16 & 2.96$^{**}$ & 0.31 & -0.09 & 0.02 & 1.25 & 3.46$^{*}$ & 3.57$^{**}$ & -0.66 & 0.13 & 0.04 & 2.24 & 5.99$^{**}$\\
& (1.09) & (0.36) & (0.16) & & & & (0.78) & (0.41) & (0.15) & & & \\
\addlinespace
20 & 3.08$^{**}$ & 0.17 & -0.07 & 0.01 & 1.13 & 1.89 & 3.55$^{**}$ & -0.41 & 0.02 & 0.03 & 2.20 & 5.25$^{**}$\\
& (0.97) & (0.35) & (0.15) & & & & (0.79) & (0.43) & (0.15) & & & \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\item \textit{Notes:}
\item A general note.
\item[a] A specific note.
\item[b] Another specific note.
\item[c] The last note.
\end{tablenotes}
\end{threeparttable}}%
\end{table}
\end{landscape}
Here the normal page orientation continues.
\end{document}
答案2
我也会删除table
环境adjusbox
。相反,我会使用small
字体大小和较小的数组拉伸,并用包中的c
列类型替换:S
siunitx
\documentclass[12pt,twoside,english]{article}
\usepackage[a4paper,
width=16cm, %bindingoffset=-1mm,
hmarginratio=1:1, % default=2:3
vmargin=25mm,
headheight=12mm%,showframe
]{geometry}
\usepackage{pdflscape}
%\usepackage[export]{adjustbox} % not used in this MWE
\usepackage[referable]{threeparttablex}
\usepackage{array, % new
booktabs}
\newcommand\mc[1]{\multicolumn{1}{>{$}c<{$}}{#1}} % new
\usepackage{etoolbox}
\appto\TPTnoteSettings{\footnotesize}
\setlength{\defaultaddspace}{3pt} % increased from 2pt
\usepackage{siunitx} % new
\usepackage[format=default,
%justification=justified,
labelfont=bf,
font=small,
skip=0pt]{caption}
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[CE]{\textit{Author}}
\fancyhead[RE]{}
\fancyhead[LO]{}
\fancyhead[CO]{\textit{Title}}
\fancyhead[RO]{\thepage}
\pagestyle{fancy}
\begin{document}
This text should be on a normal page.
\begin{landscape}
% \begin{table}[h!]
% \begin{adjustbox}{valign=C,raise=2cm}
\sisetup{input-symbols = {( )},
table-align-text-post=false,
}
\renewcommand\arraystretch{0.8} % <-----
\small % <-----
\begin{threeparttable}
\caption{A long caption that spans multiple lines, so it adds considerable height tot the total table height. This makes is even more important to center the table vertically as the bottom of the tbale comes very close to the bottom of the page. This does not look good when printing the document on paper.}
\begin{tabular}{c
*{3}{S[table-format=-1.2,
table-space-text-post={$^{**}$}]}
*{2}{S[table-format=1.2]}
S[table-format=2.2,
table-space-text-post={$^{**}$}]
*{3}{S[table-format=-1.2,
table-space-text-post={$^{**}$}]}
*{2}{S[table-format=1.2]}
S[table-format=2.2,
table-space-text-post={$^{**}$}]
}
\toprule
& \multicolumn{12}{c}{\emph{Spanner head}} \\
\cmidrule(l){2-13}
& \multicolumn{6}{c}{Left panel} & \multicolumn{6}{c}{Right panel} \\
\cmidrule(lr){2-7} \cmidrule(l){8-13}
${k}$ & \mc{Column 1} & \mc{Column 2} & \mc{Column 3} & \mc{Column 4\tnote{a}}
& \mc{Column 5} & \mc{Column 6\tnote{c}}
& \mc{Col. 1} & \mc{Col. 2} & \mc{Col. 3} & \mc{Col. 4\tnote{a}}
& \mc{Col. 5} & \mc{Col. 6\tnote{c}} \\
\midrule
1 & 2.45\tnote{**} & 1.28\tnote{**} & -0.33\tnote{**} & 0.06 & 3.41 & 8.49\tnote{**} & 2.45\tnote{**} & 1.28\tnote{**} & -0.33\tnote{**} & 0.06 & 3.41 & 8.49\tnote{**}\\
& (0.40) & (0.39) & (0.12) & & & & (0.40) & (0.39) & (0.12) & & & \\
\addlinespace
2 & 2.29\tnote{**} & 1.55\tnote{**} & -0.40\tnote{**} & 0.13 & 2.65 & 20.42\tnote{**} & 2.20\tnote{**} & 1.79\tnote{**} & -0.47\tnote{**} & 0.12 & 3.30 & 17.51\tnote{**}\\
& (0.44) & (0.36) & (0.11) & & & & (0.36) & (0.36) & (0.12) & & & \\
\addlinespace
3 & 2.26\tnote{**} & 1.51\tnote{**} & -0.38\tnote{**} & 0.16 & 2.32 & 25.39\tnote{**} & 2.26\tnote{**} & 1.40\tnote{**} & -0.33\tnote{*} & 0.07 & 3.38 & 10.80\tnote{**}\\
& (0.45) & (0.35) & (0.11) & & & & (0.41) & (0.44) & (0.14) & & & \\
\addlinespace
4 & 2.25\tnote{**} & 1.44\tnote{**} & -0.36\tnote{**} & 0.18 & 2.09 & 29.38\tnote{**} & 2.29\tnote{**} & 1.23 & -0.27 & 0.06 & 3.41 & 8.52\tnote{**}\\
& (0.58) & (0.33) & (0.12) & & & & (0.50) & (0.68) & (0.22) & & & \\
\addlinespace
5 & 2.28\tnote{**} & 1.37\tnote{**} & -0.34\tnote{**} & 0.19 & 1.92 & 31.36\tnote{**} & 2.49\tnote{**} & 1.05\tnote{**} & -0.25\tnote{*} & 0.04 & 3.44 & 5.78\tnote{**}\\
& (0.56) & (0.33) & (0.12) & & & & (0.52) & (0.38) & (0.12) & & & \\
\addlinespace
6 & 2.34\tnote{**} & 1.24\tnote{**} & -0.30\tnote{**} & 0.19 & 1.79 & 29.83\tnote{**} & 2.71\tnote{**} & 0.57\tnote{*} & -0.12 & 0.01 & 3.50 & 1.80\\
& (0.58) & (0.30) & (0.11) & & & & (0.53) & (0.27) & (0.10) & & & \\
\addlinespace
7 & 2.40\tnote{**} & 1.13\tnote{**} & -0.27\tnote{*} & 0.18 & 1.69 & 27.62\tnote{**} & 2.83\tnote{**} & 0.40 & -0.09 & 0.00 & 3.52 & 0.88\\
& (0.63) & (0.28) & (0.11) & & & & (0.57) & (0.36) & (0.11) & & & \\
\addlinespace
8 & 2.48\tnote{**} & 1.03\tnote{**} & -0.25\tnote{*} & 0.16 & 1.61 & 25.02\tnote{**} & 3.07\tnote{**} & 0.27 & -0.11 & 0.00 & 3.52 & 0.44\\
& (0.65) & (0.26) & (0.10) & & & & (0.62) & (0.72) & (0.21) & & & \\
\addlinespace
12 & 2.77\tnote{**} & 0.61 & -0.17 & 0.08 & 1.40 & 11.03\tnote{**} & 3.37\tnote{**} & -0.26 & 0.02 & 0.01 & 2.33 & 1.76\\
& (0.78) & (0.48) & (0.15) & & & & (1.15) & (1.07) & (0.29) & & & \\
\addlinespace
16 & 2.96\tnote{**} & 0.31 & -0.09 & 0.02 & 1.25 & 3.46\tnote{*} & 3.57\tnote{**} & -0.66 & 0.13 & 0.04 & 2.24 & 5.99\tnote{**}\\
& (1.09) & (0.36) & (0.16) & & & & (0.78) & (0.41) & (0.15) & & & \\
\addlinespace
20 & 3.08\tnote{**} & 0.17 & -0.07 & 0.01 & 1.13 & 1.89 & 3.55\tnote{**} & -0.41 & 0.02 & 0.03 & 2.20 & 5.25\tnote{**}\\
& (0.97) & (0.35) & (0.15) & & & & (0.79) & (0.43) & (0.15) & & & \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\note{A general note.} % changed
\item[a] A specific note.
\item[b] Another specific note.
\item[c] The last note.
\end{tablenotes}
\end{threeparttable}
% \end{adjustbox}
% \end{table}
\end{landscape}
Here the normal page orientation continues.
\end{document}