1

Common cell is not centered vertically. enter image description here

Without \setlength\cellspacetoplimit{5pt} and \setlength\cellspacebottomlimit{5pt}, it is centered.

enter image description here

But I do want additional spacing between rows. I can adjust it manually by writing \multirow{2}{*}[-2pt]{...} and then trying different fixup parameters. How can I do it without hard-coding the fixup parameter?

\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}

...

\begin{tabular}{Sl Sl} \hline
\multirow{2}{*}{Common cell}
                                  & first cell \\ \cline{2-2}
                                  & second cell\\ \hline
\end{tabular}
1
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Apr 18, 2016 at 1:31

1 Answer 1

1

I would suggest another approach: using booktabs, you get horizontal rules which have some vertical padding (\aboverulesep and \belowrulesep), which results in more or less the same layout as cellspace, and variable line widths. There is also the need for a correction, but is intrinsic (-\aboverulesep), and it may be incorporated in a user command. Of course, it may vary for multirows of more than 2 rows.

\documentclass{article}
\usepackage{cellspace, multirow, booktabs}
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}

\begin{document}

\begin{tabular}{Sl Sl} \hline
\multirow{2}{*}[-0.3ex]{Common cell}
                                  & first cell \\ \cline{2-2}
                                  & second cell\\ \hline
\end{tabular}
\vskip1cm
\begin{tabular}{ll} \toprule
\multirow{2}{*}[-\aboverulesep]{Common cell}
                                  & first cell \\
                                  \cmidrule{2-2}
                                  & second cell\\ \bottomrule
\end{tabular}

\end{document}

enter image description here

4
  • What do I write for multirows of more than 2 rows? Apr 18, 2016 at 3:37
  • I guess you would have to add a correction of $-n$\aboverulesep for $n$ rows. I might be automated in a command, but it's more complex than one might think: should work for one-line rows. For rows with more than one line (typically p{some length} or X columns) , you'd have to count the total number of lines, not the number of rows, and use the number of rows for the correction, more precisely the number of rules .
    – Bernard
    Apr 18, 2016 at 8:54
  • Still don't understand. What if I have 5 rows, for example? Apr 19, 2016 at 19:54
  • Ther will be some manual adjustment because of the parameters that come into action. Basically you count the total number of lines in the five rows to a rough estimate, then adjust to take into account \aboverulesep, thickness of horizontal rules, and things like that. It would be easier to explain what to do if you posted a minimal example.
    – Bernard
    Apr 19, 2016 at 20:26

You must log in to answer this question.

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