6

I have seen similar questions on the matter (Question 1, Question 2) of adding vertical space and not breaking vertical lines, the solutions suggested are to add space after the \\ using \\[0.1cm] for example or changing the \arraystretch which I do not want to do. Using \\[0.1cm] allows me to add space just before a \hline but not after as well.

How can I add vertical space after a \hline without breaking vertical lines in a table?

Please find my MWE below:

\documentclass{scrreprt}
\usepackage{setspace}
\usepackage[left=2.5cm,right=2.5cm,top=3cm,bottom=3cm]{geometry}
\usepackage{array,tabularx}
\doublespacing

\begin{document}
\begin{table}[htb]
  \centering
  \onehalfspacing
  \caption{Table of info.}

    \begin{tabular}{c | c c}
 & C/S Analyser & O/N/H Analyser \\
 & EMIA 320 V2 & EMGA 830 \\[0.1cm]
   \hline
   \noalign{\vskip 0.1cm}
Sensitivity (ppm) & 0.1 & 0.001 \\
Furnace type & Induction & Impulse \\
Carrier gas & Pure O2 & Pure He \\[0.1cm]
   \hline
    \end{tabular}

  \doublespacing
  \label{tab:chem}
\end{table}
\end{document}
  • 1
    Look in booktab packages. It offer \toprule, \midrule, \bottomrule, ..., \addlinespace. It is dedicated to write beautiful tables. – Zarko May 26 '15 at 21:09
  • 1
    Instead of a \vskip, place a large(r) vertical strut inside the first cell; something like \rule{0pt}{\dimexpr.7\normalbaselineskip+1mm}. For more on table-related struts, see Column and row padding in tables. – Werner May 26 '15 at 21:16
  • @Werner thanks for your suggestion, I will have a read, anything I can learn is more than welcome – Fiztban May 26 '15 at 22:11
6

You can do that with the cellspace package: define a minimal vertical padding of rows, and prefix the relevant column specifier with the letter S (or C if you use siunitx):

\documentclass{scrreprt}
\usepackage{setspace}
\usepackage[left=2.5cm,right=2.5cm,top=3cm,bottom=3cm]{geometry}
\usepackage{array,tabularx}
\doublespacing
\usepackage{cellspace}
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}
\begin{document}

\begin{table}[htb]
  \centering
  \onehalfspacing
  \caption{Table of info.}
  \begin{tabular}{c | Sc c}
    \hline
                      & C/S Analyser & O/N/H Analyser \\
                      & EMIA 320 V2 & EMGA 830 \\
    \hline
    Sensitivity (ppm) & 0.1 & 0.001 \\
    Furnace type & Induction & Impulse \\
    Carrier gas & Pure O2 & Pure He \\
    \hline
  \end{tabular}

  \doublespacing
  \label{tab:chem}
\end{table}
\end{document} 

enter image description here

  • Thank you for your answer, I will make use of this method in future tables though for this one I will use the above answer by Arash, I accept your response as it answers my question however for anyone else who in future may need to adopt this method – Fiztban May 26 '15 at 22:15
  • 1
    I agree the solution without vertical lines is much more beautiful (and that's what I do usually). Let me say that booktabs adds some vertical padding to horizontal rules, which you can customise changing the values of aboverulesep and \belowrulesep. But cellspace is a quite useful package in many cases, as vertical spacing in latex's tables is often much too tight. – Bernard May 26 '15 at 22:25
  • Thank you for your addition of info, I am still learning the tricks of the dark art of table making and I do try to generally avoid vertical lines if not necessary as it does make a table much more pleasant. – Fiztban May 26 '15 at 22:37
6

I suggest you drop the vertical line completely. How about something like this?

\documentclass{scrreprt}
\usepackage{setspace}
\usepackage[left=2.5cm,right=2.5cm,top=3cm,bottom=3cm]{geometry}
\usepackage{array,tabularx,booktabs}
\doublespacing

\begin{document}
\begin{table}[htb]
  \centering
  \onehalfspacing
  \caption{Table of info.}
    \begin{tabular}{@{}ccc@{}}
      \toprule
      Parameter & C/S Analyser & O/N/H Analyser \\
                & EMIA 320 V2 & EMGA 830 \\%
      \cmidrule(r){1-1}\cmidrule(lr){2-2}\cmidrule(l){3-3}
      Sensitivity (ppm) & 0.1 & 0.001 \\
      Furnace type & Induction & Impulse \\
      Carrier gas & Pure O2 & Pure He \\[0.1cm]
      \bottomrule
    \end{tabular}
  \doublespacing
  \label{tab:chem}
\end{table}
\end{document}

enter image description here

  • Thank you for your response, I quite like your method of dealing with the issue for this particular table, I am not sure I quite understand the use of the @{} symbol when defining the table, is there an easy explenation to that notation? – Fiztban May 26 '15 at 22:08
  • I will accept the below answer by Bernard as it answers my question but I will be using your solution as it is stylistically superior to my original table in many ways. – Fiztban May 26 '15 at 22:14
  • 1
    @{} kills the horizontal space included by LaTeX at the beginning or end of a cell. Take a closer look at the position of Sensitivity and O/N/H Analyser. – Arash Esbati May 26 '15 at 22:38
  • Ooooh I see, cause it wasn't really explained in great detail within the tabular and tabularx package instructions and had left me rather confused. Thank you, that clears much of my confusion to some notation. Have a good day! – Fiztban May 26 '15 at 22:44
  • 1
    This is a feature of vanilla LaTeX, no extra package needed. E.g., try texdoc lshort, section 2.11.6 Tabular. – Arash Esbati May 27 '15 at 15:43
3

In case, that you not need array andcolortbl in other tables, than you can obtain beautiful table by means of (almost forgotten) package mdwtab:

\documentclass{article}
\usepackage{setspace}
\usepackage[left=2.5cm,right=2.5cm,top=3cm,bottom=3cm]{geometry}
    \usepackage{caption}
\usepackage{mdwtab,tabularx}
\doublespacing

\usepackage[active,floats,tightpage]{preview}
    \setlength\PreviewBorder{1em}

    \begin{document}

    \onehalfspacing
\begin{table}[htb]
    \centering
\caption{Table of info.}
    \label{tab:chem}
        \begin{tabular}{c | c c}
    \hlx{hv}
    & C/S Analyser & O/N/H Analyser \\
    & EMIA 320 V2 & EMGA 830 \\
    \hlx{vhv}
Sensitivity (ppm) & 0.1 & 0.001 \\
Furnace type & Induction & Impulse \\
Carrier gas & Pure O2 & Pure He \\
    \hlx{vh}
        \end{tabular}

\end{table}
    \doublespacing
    \end{document}

If you need more vertical space around midle line in table, just add additional v in \hlx parameters. for example \hlx{vvhvv}. For more information about this package read manual (it is in dvi format).

enter image description here

  • Thank you for sharing this more "underrated" package I will experiment with it at a future date, do you know why it's almost forgotten? Are you sure it's not simply outclassed by more recent ones? Just curiosity questions :) – Fiztban May 26 '15 at 22:16
  • 1
    This package is to my opinion very powerful. Its week point is that it is not compatible with array, ... [table]xcolor and/or \colortbl. Probably that is reason why it is not wide used (conclusion I made on facts, that recent ten years I didn't observe any mention of it). Another reason can be that Mark Wooding, author of package, around 2002 left his activity in (La)Tex "domain" and stop with maintaining/improving his packages. I still regularly use mdwab, especial in cases of writing tables with transformation pairs (like Fourier, etc) than when I use footnotes in table etc. – Zarko May 26 '15 at 22:28
  • Thank you for your explenation, I will experiment in future tables then as I do not foresee requiring colour for the time being, much appreciated for your help, have a nice day! – Fiztban May 26 '15 at 22:42
2

Add \\\\[-1.5\medskipamount] after \hline This will make one more row with small height.

The value before medskipamout should be chosen appropriately.

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.