我已经尝试解决这个问题好几天了,现在我放弃了。我需要一个可以跨越多页的表格,所以我开始使用 longtable 而不是 tabularx。我尝试做一个固定宽度的列(第一个),但它仍然太宽了。当我尝试将其缩小到 3 或 4 厘米时,它不起作用。
\section{Main structural statistical parameters for the conformers calculated}
\begin{landscape}
\setlength\LTleft{-2cm}
\setlength\LTright{-4cm}
\begin{longtable}{r{4cm} |c|c|c|c|c|}
\caption[Chemical shift list of PG-T4 in \ce{H2O}, pH 3.5] {Main structural statistical parameters for the ensemble of the 20 lowest target function conformers calculated for PG-T4, PG-C6C15, PG-C8C13 in \ce{H2O} and 30 mM DPC, pH 3.5}\\
\toprule
&
\multicolumn{3}{c}{\textbf{\ce{H2O}}} &
\multicolumn{3}{c}{\textbf{30 mM DPC}} \\
\cmidrule(lr){2-4}
\cmidrule(lr){5-7}
&
\textbf{PG-T4} &
\textbf{PG-C6C15} &
\textbf{PG-C8C13} &
\textbf{PG-T4} &
\textbf{PG-C6C15} &
\textbf{PG-C8C13}
\\
\endfirsthead
\toprule
& &
\textbf{PG-T4} &
\textbf{PG-C6C15} &
\textbf{PG-C8C13}&
\textbf{PG-T4} &
\textbf{PG-C6C15} &
\textbf{PG-C8C13}
\\
\midrule
\endhead
\endhead
\bottomrule
\multicolumn{7}{r}{\footnotesize\itshape continue on the next page} % <-- added
\endfoot
\endlastfoot
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Upper Limit distance restraints (from NOEs) & & & & & & \\
\tab Total & numbers & numbers & numbers & numbers & numbers & numbers \\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bottomrule
\end{longtable}
\end{landscape}
\clearpage
如果您能帮助我找到这里发生的事情,我将不胜感激。
答案1
使用ltablex
,即 和 的组合longtable
,tabularx
您可以以 格式编写长表tabularx
。
一个例子(基于 mwe科莱格尔答案)预期“数字”将是实数,为此我建议使用包S
中的列类型siunitx
,是:
\documentclass{article}
\usepackage{geometry}
\usepackage{pdflscape}
\usepackage{booktabs, makecell, ltablex, tabularx}
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}
\keepXColumns
\usepackage{mhchem}
\usepackage{siunitx}
\begin{document}
\begin{landscape}
\setlength\LTcapwidth{\linewidth}
\begin{tabularx}{\linewidth}{>{\raggedright\arraybackslash}X *{6}{S[table-format=2.3]}}
\caption[Chemical shift list of PG-T4 in \ce{H2O}, pH 3.5]
{Main structural statistical parameters for the ensemble of the 20 lowest target function conformers calculated for PG-T4, PG-C6C15, PG-C8C13 in \ce{H2O} and 30 mM DPC, pH 3.5}
\label{tab:long-table} \\
\toprule
&
\multicolumn{3}{c}{\thead{\ce{H2O}}} & \multicolumn{3}{c}{\thead{30 mM DPC}} \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7}
& {\thead{PG-T4}} & {\thead{PG-C6C15}} & {\thead{PG-C8C13}}
& {\thead{PG-T4}} & {\thead{PG-C6C15}} & {\thead{PG-C8C13}} \\
\midrule
\endfirsthead
\caption{Main structural statistical parameters for the ensemble of the 20 lowest target function conformers calculated for PG-T4, PG-C6C15, PG-C8C13 in \ce{H2O} and 30 mM DPC, pH 3.5 (cont.)}\\
\toprule
&
\multicolumn{3}{c}{\thead{\ce{H2O}}} & \multicolumn{3}{c}{\thead{30 mM DPC}} \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7}
& {\thead{PG-T4}} & {\thead{PG-C6C15}} & {\thead{PG-C8C13}}
& {\thead{PG-T4}} & {\thead{PG-C6C15}} & {\thead{PG-C8C13}} \\
\midrule
\endhead
\midrule[\heavyrulewidth]
\multicolumn{7}{r}{\footnotesize\itshape continue on the next page} \\
\endfoot
\bottomrule
\endlastfoot
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Upper Limit distance restraints (from NOEs)
& & & & & & \\
Total & 12.345 & 22.345 & 32.345 & 42.345 & 52.345 & 62.345 \\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tabularx}
\end{landscape}
\end{document}
经过三次编译你将获得:
答案2
1)将要使用的columntypes的参数存在2个问题
第一:减少列数(6 列而不是 7 列)
第二:r 列不接受长度参数(除非您先重新定义它)我使用 p 列类型,它接受参数并自动换行(您可以尝试 m 或者>{\arraybackslash\raggedleft}p{4cm}
如果您确实需要它右对齐)
2)最后一行有一个额外的分隔符
\documentclass{article}
\usepackage{lscape}
\usepackage{longtable}
\usepackage{array}
\usepackage{mhchem}
\usepackage{booktabs}
\def\tab{}
\begin{document}
\section{Main structural statistical parameters for the conformers calculated}
\begin{landscape}
\setlength\LTleft{-2cm}
\setlength\LTright{-4cm}
\begin{longtable}{p{4cm} cccccc}
\caption[Chemical shift list of PG-T4 in \ce{H2O}, pH 3.5] {Main structural statistical parameters for the ensemble of the 20 lowest target function conformers calculated for PG-T4, PG-C6C15, PG-C8C13 in \ce{H2O} and 30 mM DPC, pH 3.5}\\
\toprule
&
\multicolumn{3}{c}{\textbf{\ce{H2O}}} &
\multicolumn{3}{c}{\textbf{30 mM DPC}} \\
\cmidrule(lr){2-4}
\cmidrule(lr){5-7}
&
\textbf{PG-T4} &
\textbf{PG-C6C15} &
\textbf{PG-C8C13} &
\textbf{PG-T4} &
\textbf{PG-C6C15} &
\textbf{PG-C8C13}
\\
\endfirsthead
\toprule
&
\textbf{PG-T4} &
\textbf{PG-C6C15} &
\textbf{PG-C8C13}&
\textbf{PG-T4} &
\textbf{PG-C6C15} &
\textbf{PG-C8C13}\\
\midrule
\endhead
\endhead
\bottomrule
\multicolumn{7}{r}{\footnotesize\itshape continue on the next page} % <-- added
\endfoot
\endlastfoot
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Upper Limit distance restraints (from NOEs) & & & & & & \\
\tab Total & numbers & numbers & numbers & numbers & numbers & numbers \\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bottomrule
\end{longtable}
\end{landscape}
\clearpage
\end{document}