我有一个\sidewaystable
也是 的\threeparttable
。我正尝试使用 booktabs 来制作它。在形状列中,有一些字母超过 8 个的单词,TeX 会不断将其连字符化。列宽已设置为其当前值,以确保整个表格适合 A4 页面。
无论我是否在\noalign{smallskip}
后面包含\toprule
,\midrule
我都会收到错误:
! Misplaced \cr.
\reserved@c ->\ifnum 0=`{}\fi \cr
l.34 \toprule
\noalign{smallskip}
?
以下是一个例子
\documentclass[12pt,a4paper,openleft,draft]{report}
\usepackage[lmargin=4.0cm, rmargin=2.5cm,tmargin=3cm,bmargin=2.5cm]{geometry}
\usepackage{natbib}
\usepackage{mathpazo}
\usepackage{overpic}
\usepackage[margin=10pt,font=small,labelfont=bf,labelsep=period,singlelinecheck=false]{caption}
\usepackage{threeparttable}
\usepackage{rotating}
\usepackage{units}
\usepackage{sectsty}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{setspace}
\usepackage{url}
\usepackage[english]{babel}
\usepackage{booktabs}
\usepackage{slantsc}
\usepackage{amsmath}
\usepackage{MnSymbol}
\usepackage{array}
\begin{document}
\begin{sidewaystable}[htp]
\begin{scriptsize}
\begin{center}
\caption{Key morphological characteristics}
\label{tab:cycadnmorph}
\begin{threeparttable}
\begin{tabular}
{>{\raggedright}p{3.05cm}>{\raggedright}p{0.6cm}>{\raggedright}p{1.5cm}>{\raggedright}p{2cm}>{\raggedright}p{1.75cm}>{\raggedright}p{1.75cm}>{\raggedright}p{0.25cm}>{\raggedright}p{2cm}>{\raggedright}p{1.5cm}>{\raggedright}p{1.75cm}>{\raggedright}p{1.75cm}}}
\tabularnewline
\toprule\noalign{smallskip}
&&C&&&&&H&&&\tabularnewline
\cmidrule{3-6}
\cmidrule{8-11}
Species&OTU\tnote{a}&Cells\tnote{b}&Shape&Length\tnote{c}&Width\tnote{c}&&Shape&(\%)\tnote{d}&Length\tnote{c}&Width\tnote{c}\tabularnewline
\midrule\noalign{smallskip}
\emph{species name}&A&number (min, max)&Shape&number (min, max)&number (min, max)&&Shape Bigshape biggershape&number (min, max)&number (min, max)&number (min, max)\tabularnewline
\emph{species name}&A&number (min, max)&Shape&number (min, max)&number (min, max)&&Shape Bigshape biggershape&number (min, max)&number (min, max)&number (min, max)\tabularnewline
\emph{species name}&A&number (min, max)&Shape&number (min, max)&number (min, max)&&Shape Bigshape biggershape&number (min, max)&number (min, max)&number (min, max)\tabularnewline
\emph{species name}&A&number (min, max)&Shape&number (min, max)&number (min, max)&&Shape Bigshape biggershape&number (min, max)&number (min, max)&number (min, max)\tabularnewline
\bottomrule
\end{tabular}
\begin{tablenotes}
\item [a] Data adapted.
\item [b] ND, no data.
\item [c] Accession numbers
\item[d] D
\end{tablenotes}
\end{threeparttable}
\end{center}
\end{scriptsize}
\end{sidewaystable}
\end{document}
答案1
要使用的命令是\addlinespace
;你也犯了一个错误}
:
\begin{threeparttable}
\begin{tabular}{
>{\raggedright}p{3.05cm}
>{\raggedright}p{0.6cm}
>{\raggedright}p{1.5cm}
>{\raggedright}p{2cm}
>{\raggedright}p{1.75cm}
>{\raggedright}p{1.75cm}
>{\raggedright}p{0.25cm}
>{\raggedright}p{2cm}
>{\raggedright}p{1.5cm}
>{\raggedright}p{1.75cm}
>{\raggedright}p{1.75cm}
}
\toprule\addlinespace[\smallskipamount]
不过,我认为没有必要添加这样的空间。
代码中还有其他可以改进的地方。例如,定义
\newcolumntype{P}[1]{>{\raggedright}p{#1}}
在序言中,你的表格序言可以简化为
\begin{tabular}{
P{3.05cm}
P{0.6cm}
P{1.5cm}
P{2cm}
P{1.75cm}
P{1.75cm}
P{0.25cm}
P{2cm}
P{1.5cm}
P{1.75cm}
>{\arraybackslash}P{1.75cm}
}
这样您就不需要使用\tabularnewline
它来结束表格行。
桌子外壳可以更简单地
\begin{sidewaystable}[htp]
\caption{Key morphological characteristics}
\label{tab:cycadnmorph}
\centering\scriptsize
\begin{threeparttable}
...<the tabular>...
\begin{tablenotes}
\item [a] Data adapted.
\item [b] ND, no data.
\item [c] Accession numbers
\item[d] D
\end{tablenotes}
\end{threeparttable}
\end{sidewaysttable}