我有一张表格太长,无法适应当前页边距。我想知道是否可以只覆盖此表格的页边距,使其适合 A4 页面,但不适合其余文本?
\begin{table}
\centering
\caption{Caption}
\label{tab:my_label}
\begin{tabular}{@{}l*{7}{c}}
\toprule
& & \thead{Obs.} & \thead{Mean} & \thead{Median} & \thead{Std.dev.} & \thead{p-value\\(diff. in means)} & \thead{p-value\\(diff. in medians}
\\\midrule
Panel A. Matching Characteristics & & & & & & & \\
\hspace{3mm}Log(assets) & Green Bond & 108 & 9.621 & 9.501 & 1.803 & 0.059 & 0.03 \\
\\\bottomrule
\end{tabular}
\end{table}
答案1
使用该changepage
包:
\documentclass{article}
\usepackage[strict]{changepage}
\usepackage{tabularray}
\UseTblrLibrary{booktabs,
siunitx,
varwidth}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document
\begin{document}
\lipsum[11]
\begin{table}[ht]
\begin{adjustwidth}{}{-\dimexpr\marginparwidth+\marginparsep} % <---
\begin{talltblr}[
caption = {Caption},
label = {tab:my_label},
note{a} = {SD: Standard Deviation},
note{b} = {$p$-value for Difference in means},
note{c} = {$p$-value for Difference in medians}
]{colspec = {@{}*{3}{Q[l]} c *{5}{X[c, m, si={table-format=1.3}]} @{}},
colsep = 3pt,
row{1} = {font=\bfseries},
measure = vbox
}
\toprule
~ & & & Obs. & {{{Mean}}}
& {{{Median}}}
& {{{SD\TblrNote{a} }}}
& {{{$p$\TblrNote{b} (mean)}}}
& {{{$p$\TblrNote{c} (meadian)}}} \\
\midrule
\SetCell[c=3]{l} {Panel A:\\ Matching Characteristics}
& & & & & & & & \\
\hline[dashed]
& Log(assets)
& Green Bond
& 108 & 9.621 & 9.501 & 1.803 & 0.059 & 0.03 \\
\bottomrule
\end{talltblr}
\end{adjustwidth}
\end{table}
\lipsum[11]
\end{document}
(红线表示页面布局)
答案2
如果没有更多信息(例如documentclass
,用途packages
和您想要的详细描述),我们只能猜测您想要实现什么。我也不明白表格的第一列。这是否接近您想要的输出?
这是由以下代码生成的
\documentclass{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{blindtext}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\blindtext
\begin{table}[h]
\centering
\makebox[\linewidth]{%
\begin{tblr}{
colspec={@{} l*{7}{c} @{}},
row{1}={font=\bfseries, m},
}
\toprule
& & Obs. & Mean & Median & Std.dev. & {p-value \\ (diff. in means)} & {p-value \\ (diff. in medians} \\
\midrule
{Panel A. Matching \\ Characteristics} & & & & & & & \\
\hspace{3mm}Log(assets) & Green Bond & 108 & 9.621 & 9.501 & 1.803 & 0.059 & 0.03 \\
\bottomrule
\end{tblr}}
\caption{Caption}
\label{tab:my_label}
\end{table}
\blindtext
\end{document}
当然,我只能猜测诸如documentclass
和之类的事情margin
,所以请提供更多信息以便我们提供帮助。
这个布局有很多不太好的地方。这只是为了澄清你的问题。