1

I have made a table using the \booktabs package and the result is a follows

enter image description here

with the code:

\begin{table}[h!]
\centering
\begin{tabular}{@{}lll@{}}
\toprule
Process & Cross section\\ 
\midrule 
GGF & 43.92   \\
VBF & 3.748   \\
WH & 1.380   \\
ZH & 0.9753  \\
ttH & 0.5085 \\
bbH & 0.5116 \\
\bottomrule
\end{tabular}
\end{table}

However, I want the table not to look so much spread out vertically, i.e. reduce the spacing between the lines. Something like this:

enter image description here

How can I do this? Thanks!

  • 3
    It is unusually spaced out on your image. Please post a full minimal example instead of a sniplet such that we can recreate this exact image. – daleif Jul 5 '17 at 9:54
  • That is difficult, as I don't know what is going wrong here and the document is quite large.. – Mark Jul 5 '17 at 10:09
  • 3
    Well, that is the basic cost here around. Normally you just make a copy of your document, and start removing stuff. Do you by any change use a large distance between lines generally in your document? – daleif Jul 5 '17 at 10:10
  • 3
    The cause for the spacing is somewhere in your document, which we don't know. We need more information to help. – Johannes_B Jul 5 '17 at 10:33
  • 3
    please always post a complete document, from \documentclass to \end{document} that generates the image that you show. The extra space is due to some code you have not shown. – David Carlisle Jul 5 '17 at 11:02
1

Spacing between table rows can be controlled using \def\arraystretch{0.50}.

\documentclass[english]{article}
\usepackage{booktabs}

\begin{document}

\begingroup
\tabcolsep = 15.0pt
\def\arraystretch{0.50}


\begin{table}[h!]
\centering
\begin{tabular}{@{}lll@{}}
\toprule
Process & Cross section\\ 
\midrule 
GGF & 43.92   \\
VBF & 3.748   \\
WH & 1.380   \\
ZH & 0.9753  \\
ttH & 0.5085 \\
bbH & 0.5116 \\
\bottomrule
\end{tabular}
\end{table}

\endgroup

\end{document}
  • 2
    Add \linespread{3} in the preamble of this MWE and you will get the same image that in the question. Remove \def\arraystretch{0.50} and the result is still good (better). Without know the MWE the OP, you simply cannot be sure of the right solution. – Fran Jul 5 '17 at 11:02
  • 1
    setting \arraystretch less than one is almost never a good idea and will lead to inconsistent row spacing, with rows with capital letters taking more space than rows with lower case letters. – David Carlisle Jul 15 '17 at 22:39
0

enter image description here

The setting of the second table is in fact the default setting, but this shows how the the array stretch can be set back to 1 if it has been enlarged earlier in the docuemnt. In comments you indicated you did not know what part of your code was setting it or what value it had so I show here one way of printing it in the caption (or anywhere) just for debugging With most fonts \arraystretch should not be set less than 1 as that will make the lines of the table just high enough to contain their content, normally a consistent minimum row spacing is maintained even of a row has all lower case, or empty content.

\documentclass{article}
\usepackage{booktabs}
\renewcommand\arraystretch{3}
\begin{document}

\begin{table}[htp]% never use h on its own like: [h!]
\centering
\caption{with \arraystretch}
\begin{tabular}{@{}lll@{}}
\toprule
Process & Cross section\\ 
\midrule 
GGF & 43.92   \\
VBF & 3.748   \\
WH & 1.380   \\
ZH & 0.9753  \\
ttH & 0.5085 \\
bbH & 0.5116 \\
\bottomrule
\end{tabular}
\end{table}

\renewcommand\arraystretch{1}
\begin{table}[htp]% never use h on its own like: [h!]
\centering
\caption{with \arraystretch}
\begin{tabular}{@{}lll@{}}
\toprule
Process & Cross section\\ 
\midrule 
GGF & 43.92   \\
VBF & 3.748   \\
WH & 1.380   \\
ZH & 0.9753  \\
ttH & 0.5085 \\
bbH & 0.5116 \\
\bottomrule
\end{tabular}
\end{table}

\end{document}
0

The issue with \arraystretch is already explained in other answers. Additions:

  • The numbers can be aligned at the decimal marker via package siunitx.
  • There are only two columns.
  • A horizontally centered table that is not a floating object and does not have a caption can be more easily set with environment center.

Full example file:

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\begin{center}
  \renewcommand*{\arraystretch}{1}% reset to default
  \begin{tabular}{lS[table-format=2.4]}
    \toprule
    Process & {Cross section [\si{\pico\barn}]}\\
    \midrule
    GGF & 43.92   \\
    VBF &  3.748  \\
    WH  &  1.380  \\
    ZH  &  0.9753 \\
    ttH &  0.5085 \\
    bbH &  0.5116 \\
    \bottomrule
  \end{tabular}
\end{center}
\end{document}

Result

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.