7

I would like to center a multicolumn cell, usually done via \multicolumn{2}{c}{...}. However, when using extra inter-column spacing via @{\hspace{...}}, the centering includes this extra space and ends up being misaligned.

Example:

\documentclass{article}
\usepackage{multirow}
\usepackage{multicol}

\begin{document}
  \begin{tabular}{c@{\hspace{15mm}}rr@{\hspace{15mm}}rr@{\hspace{15mm}}rr}
    \multirow{2}{*}{Front} & 
      \multicolumn{2}{c}{Group 1} &
      \multicolumn{2}{c}{Group 2} &
      \multicolumn{2}{c}{Group 3}\\
    &
      Value 1.1 & Value 1.2 &
      Value 2.1 & Value 2.2 &
      Value 3.1 & Value 3.2 \\
    \end{tabular}
\end{document}

How can I fix this?

2

1 Answer 1

5

Add the space in \multicolumn as needed:

\documentclass{article}
\usepackage{multirow}
\usepackage{multicol}

\begin{document}
  \begin{tabular}{c@{\hspace{15mm}}rr@{\hspace{15mm}}rr@{\hspace{15mm}}rr}
    \multirow{2}{*}{Front} &
      \multicolumn{2}{c@{\hspace{15mm}}}{Group 1} &
      \multicolumn{2}{c@{\hspace{15mm}}}{Group 2} &
      \multicolumn{2}{c}{Group 3}\\
    &
      Value 1.1 & Value 1.2 &
      Value 2.1 & Value 2.2 &
      Value 3.1 & Value 3.2 \\
    \end{tabular}
\end{document}

enter image description here

1
  • Is the space in the @{} bound to the left or the right column? What about when I have @{} after the last or before the first column, where do I need to put it? I would appreciate a link to some kind of documentation about this issue.
    – peschü
    Apr 29, 2016 at 13:41

You must log in to answer this question.

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