我有一张很长的表格,我用 编写tabularx
,我的文档类是sn-nature
。不幸的是,表格的一半隐藏在页面的右侧。此外,我希望表格能够自适应地管理每行所需的空间:
\documentclass[sn-nature]{sn-jnl}% Style for submissions to Nature Portfolio journals
\usepackage{tabularx,booktabs, longtable}
\begin{document}
\label{my-label}
\begin{tabularx}{\textwidth}{@{} l *{8}{C} c @{}}
\toprule
\hline
\centering Model& \centering Year & \centering Input & \centering Architecture(s) & \centering Backbone(s) & Dataset(s) \\
\hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\ \hline
\bottomrule
\end{tabularx}
任何想法?
更新 1:通过尝试@samcarter_is_at_topanswers.xyz 介绍的答案,在下一页的表格顶部显示了标题和标题。
更新2:
不幸的是,前两个单元格的信息混在一起,文本被压缩了。我使用的代码:
\begin{longtblr}[
caption = {Column (1) shows the model ...},
label={my-label}
]{
colspec={ @{} X[halign=l] c X[2.1,halign=l] c c c @{} },
row{1}={halign=c},
rowhead = 1
}
\toprule
\centering Model& \centering Year & \centering Input & \centering Architecture(s) & \centering Backbone(s) & Dataset(s) \\
\midrule
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & DR(eye)VE \\
RA \cite{p} & 2020 & RGB Images, Optical Flow Map, Semantic Image & RNN & C3D & DR(eye)VE \\
model2 \cite{p} & 2021 & RGB Video Frames, Semantic Images & CNN, GCN, ConvLSTM & Custom & DADA, DR(eye)VE, TDV \\
\bottomrule
\end{longtblr}
答案1
该错误是由C
您使用的列类型引起的,该类型默认情况下不可用,并且未在您的文档中定义。
除了这个错误之外,还有其他一些问题:
您使用的是
tabularx
没有单列的。X
如果您不允许 Tabularx 调整列宽,则它无法调整列宽X
虽然列中的文本很短,但标题行中的单词却很长,增加了列的宽度。这不是一个好的解决方案,但您可以通过在标题行中给出数字或缩写并在标题中解释其含义来解决这个问题。
您的表格对于单页来说太长了。tabularx 不允许分页。我建议改用
longtblr
来自tabularray
包的。
\documentclass[sn-nature]{sn-jnl}% Style for submissions to Nature Portfolio journals
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\begin{longtblr}[
caption = {Column (1) shows the model ...},
label={my-label}
]{
colspec={ @{} X[halign=l] c X[2.1,halign=l] c c c @{} },
row{1}={halign=c},
rowhead = 1
}
\toprule
(1) & (2) & (3) & (4) & (5) & (6) \\
\midrule
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
Multi-branch \cite{p} & 2018 & RGB Video Frames, Optical Flow Maps, Semantic Images & CNN & C3D & Dataset \\
\bottomrule
\end{longtblr}
\end{document}