3

This question is based on a problem that arises in a solution to Inserting a small vertical space in a table.

The spacing between rows in a table is often too small. A good way to fix this is using invisible struts, as in this answer based on "Correct spacing for tables and arrays" in TeX and TUG News 1993 (Vol. 2, No. 3) by Claudio Beccari.

You define some struts and put them at the start or end of entries in the table:

\newcommand\T{\rule{0pt}{2.6ex}}       % Top strut
\newcommand\B{\rule[-1.2ex]{0pt}{0pt}} % Bottom strut

In the case of \frac, the article puts these struts in the numerator and denominator of the fraction.

But sometimes there are delimiters that automatically change size and will get larger if that strut is inserted inside them, which just leaves the same problem. Here's an example:

\documentclass{standalone}
\usepackage{amsmath}

\newcommand\T{\rule{0pt}{2.6ex}}  
\newcommand\B{\rule[-1.2ex]{0pt}{0pt}}

\begin{document}

\begin{tabular}{c|c}
\hline
row 1 & $\left(\displaystyle{\frac{1}{2}} +x\right) y$\\
\hline
row 2 & $\begin{cases} 1 & x>0\\
                                    0 & x<0\\
                                    0.5 & x=0
\end{cases}$
\\
\hline
row 3 & $\displaystyle{\binom{2}{4}}$\\
\hline
\end{tabular}
\quad
\begin{tabular}{c|c}
\hline
row 1 & $\left(\displaystyle{\frac{\T{}1}{2\B{}}} +x\right) y$\\
\hline
row 2 & $\begin{cases} \T{}1 & x>0\\
                                    0 & x<0\\
                                    0.5 & x=0\B{}
\end{cases}$
\\
\hline
row 3 & $\displaystyle{\binom{\T{}2}{4\B{}}}$\\
\hline
\end{tabular}
\quad
\begin{tabular}{c|c}
\hline
row 1 & \T{}$\left(\displaystyle{\frac{1}{2}} +x\right) y$\B{}\\
\hline
row 2 & \T{}$\begin{cases} 1 & x>0\\
                                    0 & x<0\\
                                    0.5 & x=0
\end{cases}$\B{}
\\
\hline
row 3 & \T{}$\displaystyle{\binom{2}{4}}$\B{}\\
\hline
\end{tabular}
\end{document}

and the output: sample output

The left table is the original without struts. The middle shows the struts inside the delimiters. The right shows the struts outside the delimiters.

Any suggestions on how to fix this? [And any idea why it seems to behave okay for \binom?]

4

It is much simpler to load the cellspace package, which ensures a *minimal vertical spacing for cells in columns with spacifier prefixed by the letter S (or C if you load siunitx). B.t.w. for display style fractionsd of binomial coefficients, you have the amsmath commands \dfrac and \dbinom:

\documentclass[border=5pt]{standalone}
\usepackage{amsmath}
\usepackage{cellspace}
\setlength{\cellspacetoplimit}{4pt}
\setlength{\cellspacebottomlimit}{4pt}

\begin{document}

\begin{tabular}{c|Sc}
\hline
row 1 & $\left(\dfrac{1}{2} +x\right) y$\\
\hline
row 2 & $\begin{cases} 1 & x>0\\
                                    0 & x<0\\
                                    0.5 & x=0
\end{cases}$
\\
\hline
row 3 & $ \dbinom{2}{4}$\\
\hline
\end{tabular}

\end{document} 

enter image description here

  • A followup - is it possible to do this just for specific rows, or maybe even specific cells, rather than for a column? – Joel Nov 9 '17 at 22:03
  • You may want to post this answer to tex.stackexchange.com/q/50352/70067 To me this looks like a better option than the answers there. – Joel Nov 9 '17 at 22:03

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.