3

I have read a few forum posts about this but couldn't really find a solution to my problem. I have a table that has 6 columns. The first line has them merged in a way so I have 3 columns.

What I am aiming for is to add a line (centralized) under the text I have on those merged columns, so it'd go from "half the first column to half the second", but the command \cline(x-y) that I learned does not accept the decimal values. My code is as shown below:

\begin{tabular}{c c c c c c}
        \hline
        \multicolumn{2}{c}{Equipe 1} & \multicolumn{2}{c}{Equipe 2} & \multicolumn{2}{c}{Equipe 3} \\ \cline{1.5-2.5}
        Jogador & Pontos & Jogador & Pontos & Jogador & Pontos \\
    \hline

\end{tabular}

The code above doesn't get the results I need, how can the workaround be done? Thanks for the patience and apologies if my english isn't so good!

0

2 Answers 2

1

You can start using booktabs and its macros. The \cmidrule macro has an option to trim:

  \cmidrule[<widht>](l{<dim>}r{<dim>}){start-end}

Here <width> is the thickness of line, l{<dim>} means trim by <dim> from left and r{<dim>} means trim by <dim> from right. You have to adjust the trim by yourself. Here is a snap shot from the manual:

enter image description here

\documentclass{article}
\usepackage{booktabs}
\begin{document}
  \begin{tabular}{c c c c c c}
        \toprule
        \multicolumn{2}{c}{Equipe 1} & \multicolumn{2}{c}{Equipe 2} & \multicolumn{2}{c}{Equipe 3} \\ \cmidrule(l{7mm}r{7mm}){1-2}
        Jogador & Pontos & Jogador & Pontos & Jogador & Pontos \\
    \bottomrule

\end{tabular}
\end{document}

enter image description here

0
2

The booktabs package is not required.

Just use \cline (e.g. \cline{3-6}). Wikipedia has a nice example at https://en.wikibooks.org/wiki/LaTeX/Tables#Columns_spanning_multiple_rows

Look under the heading for "Spanning in both directions simultaneously":

\usepackage{multirow}

\begin{tabular}{cc|c|c|c|c|l}
\cline{3-6}
& & \multicolumn{4}{ c| }{Primes} \\ \cline{3-6}
& & 2 & 3 & 5 & 7 \\ \cline{1-6}
\multicolumn{1}{ |c  }{\multirow{2}{*}{Powers} } &
\multicolumn{1}{ |c| }{504} & 3 & 2 & 0 & 1 &     \\ \cline{2-6}
\multicolumn{1}{ |c  }{}                        &
\multicolumn{1}{ |c| }{540} & 2 & 3 & 1 & 0 &     \\ \cline{1-6}
\multicolumn{1}{ |c  }{\multirow{2}{*}{Powers} } &
\multicolumn{1}{ |c| }{gcd} & 2 & 2 & 0 & 0 & min \\ \cline{2-6}
\multicolumn{1}{ |c  }{}                        &
\multicolumn{1}{ |c| }{lcm} & 3 & 3 & 1 & 1 & max \\ \cline{1-6}
\end{tabular}

rendered table

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .