Advanced Table Borders

Sometimes it is helpful to be able to provide partial border specifications, for either rows or columns.

  • \cline{i-j} provides a partial bottom border between columns i and j of the current row.

  • A combined use of \multicolumn and \multirow can build a partial vertical border.

Here is one illustrating example:

\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}
Primes
2 3 5 7
Powers 504 3 2 0 1
540 2 3 1 0
Powers gcd 2 2 0 0 min
lcm 3 3 1 1 max