1

Hi I am a beginner with tables and I'm struggling to typeset a table beautifully. Here is the code:

\documentclass[]{article}

\usepackage{fullpage}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{multirow}
\begin{document}

\begin{tabularx}{\textwidth}{l *{7}{X}}
\toprule
\multirow{4}{*}{Method} & 
\multirow{4}{\linewidth}{Time step} & 
\multirow{4}{\linewidth}{Test calculation} & 
\multirow{4}{\linewidth}{Testing update} &
\multicolumn{4}{c}{Test hello-world}\\ \cline{5-8}
& & & & Model B, $x = 42$ & Model B, $y = 42$ & ModelC longword & ModelD wordOne wordTwo\\
\midrule
A & 0.010 & 1 & 0 & 1.0 & 1.0 & 1.0 & 1.0 \\
B & 0.010 & 2 & 0 & 1.6 & 1.9 & 2.1 & 2.1 \\
C & 0.010 & 1 & 1 & 2.3 & 3.0 & 3.4 & 3.3 \\
D & 0.010 & 1 & 1 & 1.8 & 2.1 & 2.7 & 2.6 \\
E & 0.010 & 1 & 1 & 2.0 & 3.0 & 3.7 & 3.5 \\
F & 0.010 & (2) & 2 & 4.4 & 5.1 & 7.0 & 6.7 \\
\bottomrule
\end{tabularx}

\end{document}

enter image description here

The second row in the table has to little distance to the \cline. Every help to fix this issue would be appreciated.

  • 1
    Welcome to TeX.SX! You are using booktabs, did you try using its \cmidrule? (instead of \cline) – gusbrs Jul 11 '17 at 21:16
1

Once you are already using booktabs, you should use its \cmidrule instead of \cline to get:

enter image description here

  • Great, thanks a lot. I also added \multirow{4}[3]{*}{Method} to get the vertical centering for the first 4 columns which is now needed due to \cmidrule. – T.Etti Jul 11 '17 at 21:33

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.