4

I'm not very experienced in drawing tables in latex, but for this paper I have no choice. Please forgive me, if this is a stupid question.

So, here's my preamble:

\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}

and get the following error message:

illegal pream-token (\toprule): c' used

can anyone help me?

  • 4
    Use \begin{tabular}{l | c c c c | c c c c | c c c c} with curly braces. – LaRiFaRi Mar 11 '16 at 11:25
2

As mentioned in comment, you had your column specifiers in brackets instead of braces. Please see my below code:

% 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}

enter image description here

  • I have tried to run your code on Windows, but keep getting this error: ! Package array Error: Illegal pream-token (S): `c' used. See the array package documentation for explanation. Type H <return> for immediate help. ... l.86 ....0]S[table-format=2.0]S[table-format=1.0]} – lawyeR Mar 11 '16 at 18:00
  • 1
    @lawyeR apparently not. You forgot to load package siunitx. – Johannes_B Mar 20 '16 at 8:22
  • Thank you, but when I loaded siunitx, the .log showed this error: ! Package siunitx Error: Support package expl3 too old. See the siunitx package documentation for explanation. Type H <return> for immediate help. ... l.30 } You need to update your installation of the bundles 'l3kernel' and 'l3packages' – lawyeR Mar 21 '16 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.