我有一个相当宽的表格,它超出了页面的右边框,这对我来说没问题,但我希望它居中,以便它也超出左边框并且完全可见:
我可以在表格中设置一个参数来正确定位它吗?我已经使用了“\tiny”字体大小,我不知道如何更好地改进它。
这是表格代码:
\documentclass[12pt,a4paper,oneside]{report}
\usepackage[utf8]{inputenc}
\usepackage{booktabs,amssymb,caption}
\usepackage{makecell}
\begin{document}
\begin{table}[!h]
\tiny
\centering
\begin{tabular}{cccccccccccc}
\toprule
\thead{n. children\\in each stage} & \thead{SV\\simple} & \thead{SV\\unacc.} & \thead{VS\\unacc.} &\thead{Root-WH\\argument} & \thead{WH-adjunct\\\textit{why} excluded} &\thead{Preposed\\Adv} & \thead{Root\\y/n}&\thead{Why}&\thead{Relative\\clauses} & \thead{Topic} & \thead{Embedding}\\
\midrule
5 &\checkmark &\checkmark&\checkmark&&&&&&&&\\
12 &\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&&&&\\
34 &\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark\\
\bottomrule
\end{tabular}
\caption*{\small{Number of children displaying specific syntactic structures in a repetition task, adapted from (\cite{Friedmann2021-xf}:16)}}
\end{table}
\end{document}
提前致谢!
答案1
如果由于某种原因,您不想转置表格并且不想将列标题旋转 90 度,您仍然可以通过 (a) 发出指令 来使其适合文本块的宽度,以匹配表格\renewcommand\theadfont{\tiny}
其余部分使用的字体大小,以及 (b) 使用tabular*
环境(目标宽度为\textwidth
)而不是tabular
环境。
\documentclass{article}
\usepackage{makecell,booktabs,amssymb,caption}
\let\cm\checkmark % handy shortcut macro
\begin{document}
\begin{table}[!h]
\setlength\tabcolsep{0pt} % make LaTeX figure out intercolumn space
\tiny
\renewcommand\theadfont{\tiny}
\captionsetup{font=footnotesize,justification=raggedright}
%\centering % redundant
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} *{12}{c}}
\toprule
\thead{No.\ of children\\in each stage} & \thead{SV\\simple} & \thead{SV\\unacc.} &
\thead{VS\\unacc.} & \thead{Root-WH\\argument} & \thead{WH-adjunct\\ \textit{why} excluded} &
\thead{Proposed\\Adv} & \thead{Root\\y/n} & \thead{Why} &
\thead{Relative\\clauses} & \thead{Topic} & \thead{Embed-\\ding} \\
\midrule
5&\cm&\cm&\cm \\
12&\cm&\cm&\cm&\cm&\cm&\cm&\cm \\
34&\cm&\cm&\cm&\cm&\cm&\cm&\cm&\cm&\cm&\cm&\cm \\
\bottomrule
\end{tabular*}
\caption*{Number of children displaying specific
syntactic structures in a repetition task, adapted
from \cite{Friedmann2021-xf}:16.}
\end{table}
\end{document}
答案2
我建议转置表格,这样您就不必协调不同的字体大小和角度来适应。
\documentclass{article}
\usepackage{booktabs,amssymb}
\usepackage{makecell,array}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ l *{3}{w{c}{2em}} }
\toprule
& \multicolumn{3}{c}{\makecell{Number of children \\ in each stage}} \\
\cmidrule(lr){2-4}
\multicolumn{1}{c}{Syntactic structure} & 5 & 12 & 34 \\
\midrule
SV simple & \checkmark & \checkmark & \checkmark \\
SV unacc. & \checkmark & \checkmark & \checkmark \\
VS unacc. & \checkmark & \checkmark & \checkmark \\
Root-WH argument & & \checkmark & \checkmark \\
WH-adjunct \textit{why} excluded & & \checkmark & \checkmark \\
Preposed Adv & & \checkmark & \checkmark \\
Root y/n & & \checkmark & \checkmark \\
Why & \checkmark & & \checkmark \\
Relative clauses & \checkmark & \checkmark & \\
Topic & & & \checkmark \\
Embedding & \checkmark & & \\
\bottomrule
\end{tabular}
\caption{Number of children displaying specific syntactic structures in a repetition task, adapted from [X]}
\end{table}
\end{document}
答案3
编辑(2):
现在考虑已编辑的问题。并加载表格代码的最新版本。现在第一行间距正确。即在行底部对齐。
一种方法是旋转列的标题文本。这样表格就不需要跨越文本边界并使用较小的字体大小:
这可以通过多种方式来实现,我喜欢使用tabularraya
和\makecell
包rotating
:
\documentclass[12pt,a4paper,oneside]{report}
%---------------- 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
\usepackage[font=small]{caption}
\usepackage{dingbat}
\newcommand\CM{\checkmark} %
\usepackage{rotating}
\usepackage{makecell}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\lipsum[11]
\begin{table}[ht]
\renewcommand\theadfont{}
\settowidth\rotheadsize{in each stage} % from makecell
\begin{tblr}{colspec = {@{} *{12}{X[c]} @{}},
colsep = 3pt,
row{1} = {cmd=\rothead, font=\linespread{0.9}\selectfont}, % <---
}
\toprule
n. children in each stage
& SV simple
& SV unacc.
& VS unacc.
& {Root-WH\\ argument}
& WH-adjunct \textit{why} excluded
& Preposed Adv
& Root y/n
& Why
& Relative clauses
& Topic
& Embedding \\
\midrule
5 & \CM & \CM & \CM & & & & & & & & \\
12 & \CM & \CM & \CM & \CM & \CM & \CM & \CM & & & & \\
34 & \CM & \CM & \CM & \CM & \CM & \CM & \CM & \CM & \CM & \CM & \CM \\
\bottomrule
\end{tblr}
\caption*{Number of children displaying specific syntactic structures in a repetition task, adapted from (\cite{Friedmann2021-xf}:16)}
\end{table}
\lipsum[77]
\end{document}