3

I'm trying to enlarge the row-height of my booktabs-table but \arraystretch does this asymmetrically.

I am slightly confused because this is an obvious problem to me and I couldn't find any solutions or workarounds. So please let it pass if I'm just clouded...

image

\documentclass[preview]{standalone}                                                                                                 
\usepackage{booktabs}
%
\begin{document}
%\renewcommand{\arraystretch}{3} 
\begin{tabular}{lr}
    \toprule
    parameter & order of magnitude\\\midrule
    density \hfill$\varrho$ & $0$\\
    velocity \hfill$v$& test\\
    diameter \hfill$d$& test\\
    viscosity \hfill$\mu$ & $0$\\\bottomrule
\end{tabular}
\end{document}

Thanks and cheers, Stephan

2
  • 2
    Simple: don't change \arraystretch when using booktabs, but insert \addlinespace (see the package manual) between rows if you really want to spread lines (you don't, in my opinion). – egreg Oct 13 '14 at 19:30
  • 1
    Thank you! Indeed, this is a possible but not very applicable workaround. I would have to add it twice in each row. – Suuuehgi Oct 14 '14 at 6:37
5

The symmetrical way can be obtained with the cellspace package: it lets you decide on a minimal vertical spacing between the top of a cell and the bottom of the cell above, and between the bottom of a cell and the top of the cell below. You then have to prefix the specifiers of the columns for which it is useful with the letter S. Note that these minimal spacings can be set independently for the top and the bottom of cells. Also, it conflicts with the S qualifier from the siunitx package, which introduces the letter C as a replacement in its last version (§ 7.11 of the siunitx doc):

\documentclass[preview]{standalone}
\usepackage{booktabs}
\usepackage{cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}
%
\begin{document}
%\renewcommand{\arraystretch}{3}
\begin{tabular}{SlSr}
    \toprule
    parameter & order of magnitude\\\midrule
    density \hfill$\varrho$ & $0$\\
    velocity \hfill$v$& test\\
    diameter \hfill$d$& test\\
    viscosity \hfill$\mu$ & $0$\\\bottomrule
\end{tabular}
\end{document} 

enter image description here

3
  • Thank you! Just two things: (1) Why do I have to add the S twice since the first already affects the complete table(?) and (2) cellspace collides with the siunitx-package, that replaces the S with a C (compare 7.10 of the manual). – Suuuehgi Oct 14 '14 at 7:13
  • @smoneck: You're right. For 1) I wanted to give as simple an explanation as possible, but I'll correct it. For 2), in the latest version of siunitx, a C prefix is introduced as a prefix replacement(§ 7.11). – Bernard Oct 14 '14 at 8:46
  • Uh, yeah... shame on me. I linked an outdated manual-version. It was before my first coffee. – Suuuehgi Oct 14 '14 at 9:48

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.