我对在 latex 中绘制表格不是很有经验,但对于本文我别无选择。如果这是一个愚蠢的问题,请原谅我。
以下是我的序言:
\documentclass[a4paper, 12pt]{article}
\usepackage[english]{babel}
\usepackage[applemac]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{enumerate}
\usepackage{array}
\usepackage{multirow}
\usepackage{setspace}
\usepackage[pdftex]{hyperref}
\usepackage{wasysym}
\usepackage{graphicx}
\usepackage{booktabs}
\title{title}
\author{author}
\hypersetup{pdfauthor={author}, pdftitle={title}, pdfborder={0 0 0},}
\begin{document}
...
I'm trying to draw this table:
\begin{table}[h!]
\caption{Mirror movements according to Woods \& Teuber}
\begin{tabular}[l | c c c c | c c c c | c c c c ]
\toprule
& \multicolumn{4}{|c}{CP Norway}&\multicolumn{4}{|c}{CP Australia}& \multicolumn{4}{|c}{TD children}\\
& 1 & 2 & 3 & 4 & 1 & 2 & 3 & 4 & 1 & 2 & 3 & 4 \\
\midrule
& & & & & & & & & & & & \\
W\&T score 0 & 3 & 2 & 6 & 3 & 1 & 3 & 1 & 1 &16& 9 &13& 8 \\
W\&T score 1 & 4 & 3 & 3 & 4 & 4 & 3 & 2 & 2 & 5 & 9 & 9 & 8 \\
W\&T score 2 & 6 & 7 & 7 & 6 & 12&10&11&10 & 1 & 4 & 0 & 6 \\
W\&T score 3 & 2 & 5 & 1 & 2 & 1 & 2 & 3 & 3 & 0 & 0 & 0 & 0 \\
W\&T score 4 & 4 & 2 & 2 & 4 & 0 & 0 & 1 & 2 & 0 & 0 & 0 & 0 \\
\bottomrule
\end{tabular}
\bigskip
1: Mirror movements in the affected hand, while the unaffected hand is moving at normal speed. 2: Mirror movements in the affected hand, while the unaffected hand is moving at fast speed. 3: Mirror movements in the unaffected hand as the affected hand is moving at normal speed. 4: Mirror movements in the unaffected hand as the affected hand is moving at fast speed. For TD children, the non-dominant hand corresponds to the affected hand.
\label{tab:WT}
\end{table}
...
\end{document}
并收到以下错误消息:
非法前缀标记 (\toprule): 使用 c'
谁能帮我?
答案1
正如评论中提到的,您将列说明符放在括号中,而不是大括号中。请参阅以下代码:
% arara: pdflatex
\documentclass[a4paper,12pt]{article}
\usepackage[applemac]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{caption}
\usepackage{threeparttable}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage[pdftex]{hyperref} % should be last package to be loaded. I have not checked, what that option is for...
\begin{document}
I've succeeded to draw this table:
\begin{table}[h!] % just use this specifier if really needed.
\centering
\begin{threeparttable}
\caption{Mirror movements according to Woods \& Teuber}\label{tab:WT}
\begin{tabular}{l@{\hspace{5mm}} *{4}{S[table-format=1.0]} *{4}{S[table-format=2.0]} S[table-format=2.0]S[table-format=1.0]S[table-format=2.0]S[table-format=1.0]}
\toprule
& \multicolumn{4}{c}{CP Norway}&\multicolumn{4}{c}{CP Australia}& \multicolumn{4}{c}{TD children}\\
\cmidrule{2-5}\cmidrule(lr){6-9}\cmidrule{10-13}
& 1 & 2 & 3 & 4 & 1 & 2 & 3 & 4 & 1 & 2 & 3 & 4 \\
\midrule
W\&T score $$0 & 3 & 2 & 6 & 3 & 1 & 3 & 1 & 1 &16& 9 &13& 8 \\
W\&T score $1$ & 4 & 3 & 3 & 4 & 4 & 3 & 2 & 2 & 5 & 9 & 9 & 8 \\
W\&T score $2$ & 6 & 7 & 7 & 6 & 12&10&11&10 & 1 & 4 & 0 & 6 \\
W\&T score $3$ & 2 & 5 & 1 & 2 & 1 & 2 & 3 & 3 & 0 & 0 & 0 & 0 \\
W\&T score $4$ & 4 & 2 & 2 & 4 & 0 & 0 & 1 & 2 & 0 & 0 & 0 & 0 \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\item[1] Mirror movements in the affected hand, while the unaffected hand is moving at normal speed.
\item[2] Mirror movements in the affected hand, while the unaffected hand is moving at fast speed.
\item[3] Mirror movements in the unaffected hand as the affected hand is moving at normal speed.
\item[4] Mirror movements in the unaffected hand as the affected hand is moving at fast speed. For TD children, the non-dominant hand corresponds to the affected hand.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}