6

Here is my code:

Volume of the hall V = 1500 $m^3$ \\
\noindent \begin{tabular}{| c | c | c |}
\hline
\textit{Surface} & \textit{Area ($m^2)$} & \textit{Coefficient of absorption}\\
\hline
ceiling & 140 & 0.8 \\
\hline
walls & 260 & 0.03 \\
\hline
floor & 140 & 0.06 \\
\hline
\end{tabular}

This code results in a table that is very close to the text. I want to increase the space to at least 2cm. I tried adding a double line break too. It threw back some kind of hbox error. please help.

4
  • 1
    Adding a \bigskip before \\ on your first line may be what you want. Alternatively you can use \vspace{2cm} if you want to precisely choose how much space should be in between. Yet another alternative is to place the tabular in a \begin{center}/\end{center} environment, which centers the table but also adds some appropriate space.
    – yori
    Oct 2, 2014 at 7:06
  • You could use an environment, that adds some white space above and below itselve, for example. \begin{ccenter}<table>\end{center} and maybe a minipage in between.
    – Johannes_B
    Oct 2, 2014 at 7:06
  • Just in case, please have a look at When to use \par and when \\?
    – Johannes_B
    Oct 2, 2014 at 7:08
  • 2
    One question that remains: Why aren't you using a table environment? Do you want the table prevent from floating and have it typeset Iexactly at this place*? Do you need captions for your table?
    – Johannes_B
    Oct 2, 2014 at 12:45

2 Answers 2

3

You can set vertical space with \vspace{2cm}. I personally think that the standard space provided is quite pleasing, your opinion might differ. I've updated your code snippet to a full example, also adding some things which I think are good practices (as suggested by @Yori in the comments).

  • I'm using the middle-european KOMA script class, which has a global parskip option, taking care of both indentation and skipping of paragraphs.
  • The siunitx package helps with typesetting SI units (and aligning numbers in the table with the S column specifier)
  • booktabs enhances the quality of the table presentation (read it's manual for some insight).
  • blindtext helps to fill the page and
  • hyperref makes for nice referencing.

I'm fully aware that your opinion might differ, but I think the table/text combination look good like that. If you'd like to change it, you can comment line 1, uncomment lines 2--4 and play with the \vspace{2cm} option until you get a result that pleases your eyes.

\documentclass[parskip]{scrartcl}
%\documentclass{article}
%\setlength\parindent{0pt}
%\setlength\parskip{10pt}

\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{blindtext}
\usepackage{hyperref}

\begin{document}

\blindtext

Volume of the hall \(V = \SI{1500}{\cubic\metre}\), details can be found in \autoref{tab:hall details}.

%\vspace{2cm}

\begin{table}
    \centering
    \caption{Details of the hall}
    \label{tab:hall details}
    \begin{tabular}{ccS}
        \toprule
        Surface & Area (\si{\metre\squared}) & {Coefficient of absorption}\\
        \midrule
        ceiling & 140 & 0.8 \\
        walls & 260 & 0.03 \\
        floor & 140 & 0.06 \\
        \bottomrule
    \end{tabular}
\end{table}

\blindtext

\end{document}

Screenshot

8
  • +1 for adding in some best practices. It's probably good to explain what you did though. For example, why did you use booktabs instead?
    – yori
    Oct 2, 2014 at 7:24
  • [h] does not make sure, that the table stays there for good. What happens if the table is floated to another page with the vspace?
    – Johannes_B
    Oct 2, 2014 at 7:33
  • If parindent is set to zero, parskip should differ from zero to visually clarify the beginning of a new paragraph in the output.
    – Johannes_B
    Oct 2, 2014 at 7:34
  • @Yori: Good idea, I'll add that. @Johannes_B: I didn't think about the floating to another page, since I never™ use it myself. Does [h!] take care of that? And I definitely agree on the parskip issue, which I've added to the example.
    – Habi
    Oct 2, 2014 at 9:26
  • @Habi [h!] is not good. If such a float can't be placed “here” or ”top” (the t is automatically added), it will block the float queue.
    – egreg
    Oct 2, 2014 at 14:24
1

You can specify the lenght of the line break with \\[2cm] but I would use another approach that manually increase the spacing in this way. The same apply to alternative commands as \vspace{2cm}, \bigskip, etc to add a specific space.

In order to obtain a consistent format across the the pages, ideally you must try to set all your format preferences in the preamble and avoid messing your text with low format code. For example, you can modify globally as you want the paragraph skip, so that the table is spaced as any paragraph simply adding a blank line (\par). If you prefer mora spacing between text and tables than among the paragraphs, you can also set a different space around a table float, as well as the spacing between the caption and the table, if ther are one (it is not clear in your example if the line above the table is the caption).

Example to play with global spacing:

MWE

\documentclass{article}
\setlength{\parskip}{.5cm} % change this length as you want 
\setlength{\intextsep}{1cm plus .1cm minus 1.cm} % change this length as you want
\setlength{\belowcaptionskip}{.2cm} % change this length as you want
\begin{document}

Text before tabular   

\begin{tabular}{ccc}
\hline
\textit{Surface} & \textit{Area ($m^2)$} & \textit{Coefficient of absorption}\\
\hline
ceiling & 140 & 0.8 \\
walls & 260 & 0.03 \\
floor & 140 & 0.06 \\
\hline
\end{tabular}

Text after tabular % test space between paragraph

Text before float

\begin{table}[htb]
\caption{Volume of the hall V = 1500 $m^3$.}
\centering
\begin{tabular}{ccc}
\hline
\textit{Surface} & \textit{Area ($m^2)$} & \textit{Coefficient of absorption}\\
\hline
ceiling & 140 & 0.8 \\
walls & 260 & 0.03 \\
floor & 140 & 0.06 \\
\hline
\end{tabular}
\end{table}

Text after float

\end{document}

May be enough?

(Note that many people hate the excess of vertical and horizontal rules. I also suggest booktabs commands instead of \hline for better results.)

You must log in to answer this question.

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