2

I have a table as in the figure and code below. The problem is that it really hard to see that the cells 22-34 belongs to the multirow R-23. I would like to reduce the row spacing for these to rows to bring them close to each other. How would I do that? Preferably it is a global setting that reduces the row spacing for all multi-rows.

enter image description here

\begin{tabular}{*4l}\toprule
    \textbf{R1}                    & 12 & 13 & 14 \\
    \multirow{2}{*}{\textbf{R2-3}} & 22 & 23 & 24 \\
                                   & 32 & 33 & 34 \\
    \textbf{R4}                    & 42 & 43 & 44 \\
    \bottomrule
\end{tabular}
2

\\ has an optional argument, meaning the vertical space added. Hence you can rewrite your example as (the value is left to your taste):

\begin{tabular}{*4l}\toprule
    \textbf{R1}                    & 12 & 13 & 14 \\
    \multirow{2}{*}{\textbf{R2-3}} & 22 & 23 & 24 \\[-3pt] % here is the change
                                   & 32 & 33 & 34 \\
    \textbf{R4}                    & 42 & 43 & 44 \\
    \bottomrule
\end{tabular}
  • Thanks. This works, but you have to add this for every multirow you use, and this will cause some headaches if I decide to change the distance in the document. Anyway to make this change 'permanent' and reusable? – T'n'E Aug 19 '15 at 13:28
  • 1
    @T'n'E For example \def\NH{\\[-3pt]} and use this definition in place of the shown change. \NH is for No Headaches. :-) – Przemysław Scherwentke Aug 19 '15 at 13:37
  • Great! Now I use \setlength\extrarowheight{7pt} and \def\NH{\\[-\extrarowheight]} to cancel out the extra space for multirows. Not optimal, but not too much hassle. – T'n'E Aug 20 '15 at 7:01
2

You also can use the \addlinespace command from booktabs. The value of \defaultaddspace can be adjusted in preamble. I also slightly simplified the code for the first column:

\documentclass{article}

\usepackage{array, booktabs, multirow}

\begin{document}

\begin{tabular}{ > {\bfseries}l*3l}
  \toprule
  R1 & 12 & 13 & 14 \\
  \addlinespace
  \multirow{2}{*}{R2-3} & 22 & 23 & 24 \\
                        & 32 & 33 & 34 \\
  \addlinespace
  R4 & 42 & 43 & 44 \\
  \bottomrule
\end{tabular}

\end{document} 

enter image description here

  • Thanks for the simplified syntax. Keep forgetting that trick. Is there any benefit using \addlinespace compared to \\[-3pt]? If I understand it correctly, this would have to be added to all rows not multirow, which in my case is the majority of rows. There is no \removelinespace? – T'n'E Aug 20 '15 at 6:56
  • No real benefit, except a form of coherence (using the tools of booktabs) and, more seriously, be sure you the same amount when necessary throughout you document. You still may change its value locally, using the optionalargument to \addlinespace. For the second part of your comment, it would be used as a separator only between a \multirow and its neighbours. – Bernard Aug 20 '15 at 8:59
  • Ah, yes, now I see, but that also means that if I add another row, R5, the distance between R4 and R5 would be equal to that of the multirow. One can then argue which is more readable… – T'n'E Aug 20 '15 at 11:50
  • Yes, it will have the ‘general’ distance. Personnally, I prefer that solution but it's a matter of taste. Also, don't forget, with\setdefaultaddspace, you can modulate this spacing. – Bernard Aug 20 '15 at 11:56

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.