2

I notice that the amount of spacing above tabular changes depending on whether I have one row or more than one row:

\documentclass[12pt]{article}
\usepackage[english]{babel}

\begin{document}

Foo

\begin{tabular}{l}
    Foo
\end{tabular}

Foo

\begin{tabular}{l}
    Foo \\
    Foo
\end{tabular}

\end{document}

produces the output:

enter image description here

The space above the first tabular environment, which only has one line, is greater than the space above the second tabular environment, which has two lines. I like the amount of space that is above the one-line tabular environment, but how can I ensure the same amount of space will be above the two-line tabular environment?

1 Answer 1

3

This stems from the default centred vertical alignment of tabular. Either

  1. Issue \strut as part of the middle non-tabular Foo. This will ensure a proper baseline to butt up against (vertically):

    \documentclass{article}
    
    \begin{document}
    
    Foo
    
    \begin{tabular}{l}
      Foo
    \end{tabular}
    
    \strut
    Foo
    
    \begin{tabular}{l}
      Foo \\ Foo
    \end{tabular}
    
    \end{document}
    
  2. Let the second tabular be [t]op-aligned:

    \documentclass{article}
    
    \begin{document}
    
    Foo
    
    \begin{tabular}{l}
      Foo
    \end{tabular}
    
    Foo
    
    \begin{tabular}[t]{l}
      Foo \\ Foo
    \end{tabular}
    
    \end{document}
    

In both instances, the desired outcome is achieved:

enter image description here

You must log in to answer this question.

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