4

I have created a fairly simple table using booktabs:

\renewcommand{\arraystretch}{1.5}
\begin{table}[h!]
  \centering
  \footnotesize
  \begin{tabular}{ p{5cm} | p{5cm} }
    \toprule
    \textbf{Primäre Quellen} & \textbf{Sekundäre Quellen} \\
    Jira              &  exply \\
    Confluence        &  Canias ERP \\
    E-Mail            &  Diverse Excel-Tabellen (Vertrieb, Verwaltung) \\
    Nextcloud         & \\
    Rocket.Chat       & \\
    GitLab/GitHub     & \\
    \bottomrule
  \end{tabular}
    \label{table:informationsquellen}
    \caption{Primäre und sekundäre Quellen bei XXXXXX}
\end{table}

Currently, the rows are "aligned": enter image description here I want to remove the alignment, making the columns independent of each other (effectively removing the green outlined space).

Is this possible? How can I do that?

  • Than make only one cell in each column and use \par to move text in new line or inserts empty lines between text formed paragraphs. – Zarko Aug 8 at 12:53
  • Why use a table at all if the two columns are not related? Wouldn't a list like enumerate or itemize serve the same purpose without the reader wondering if there is a correlation between the columns or not? Please also note, that booktabs horizontal lines are not compatible with vertical lines (hence the small gaps in the vertical lines). – leandriis Aug 8 at 12:57
  • If you want to stay with a table, why not simply use two l type columns? The table should still fit into the textwidth of a standard article even without linebreaks in the cells. – leandriis Aug 8 at 12:59
  • 2
    Off-topic but nevertheless important: the \label directive must be placed after the associated \caption directive. Otherwise, cross-references to the table cannot be correct. – Mico Aug 8 at 13:09
  • I want to use a table because a: a list is not as easy on the eyes, but hard to ignore inside a block of text and b: the table is supposed to be fairly small, floating somewhere so the reader can look it up if he wants to, but does not have to. – Thomas Pötzsch Aug 8 at 14:07
6

You can make a tabular containing only one row, and break lines inside a cell using either \par as shown below, or \newline. As leandriis warned, horizontal lines created by commands from the booktabs package aren't designed to join well with vertical lines (the author of booktabs explains in the manual of his great package that vertical lines in tables are almost always a bad typographic choice: both ugly and useless).

\documentclass{article}
\usepackage{booktabs}

\begin{document}

\renewcommand{\arraystretch}{1.5}%
\begin{tabular}{ p{5cm} | p{5cm} }
  \toprule
  \textbf{Primäre Quellen}\par
  Jira\par
  Confluence\par
  E-Mail\par
  Nextcloud\par
  Rocket.Chat\par
  GitLab/GitHub &
  \textbf{Sekundäre Quellen}\par
  exply\par
  Canias ERP\par
  Diverse Excel-Tabellen (Vertrieb, Verwaltung)\\
  \bottomrule
\end{tabular}

\end{document}

screenshot

You can get a nicer layout by removing the \renewcommand{\arraystretch}{1.5}, using a dedicated row for the table header, finishing it with \\\midrule and suppressing the vertical rule. As per leandriis' suggestion, I also added >{\raggedright\arraybackslash} in front of the second column specification in the tabular preamble, so that interword spacing in the second column doesn't get overstretched (this way, it is not stretched at all; as a consequence, the right side of the second column is allowed to have a “ragged” appearance, which doesn't change much here since we were ending lines/paragraphs manually anyway). The >{...} syntax requires the array package, hence we are adding it too.

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}

\begin{document}

\begin{tabular}{ p{5cm} >{\raggedright\arraybackslash} p{5cm} }
  \toprule
  \textbf{Primäre Quellen} & \textbf{Sekundäre Quellen}\\
  \midrule
  Jira\par
  Confluence\par
  E-Mail\par
  Nextcloud\par
  Rocket.Chat\par
  GitLab/GitHub &
  exply\par
  Canias ERP\par
  Diverse Excel-Tabellen (Vertrieb, Verwaltung)\\
  \bottomrule
\end{tabular}

\end{document}

screenshot

You could also do that using multicols (possibly inside a minipage) and/or enumitem. There are many possibilities.

P.S.: as Mico said, if you use \caption and \label, be sure to put \label after the associated \caption, because it is \caption that increases the counter (\label uses the last reference set with \refstepcounter)!

  • You might want to consider adding \raggedright\arraybackslash to the second p type column to prevent the large white spaces (e.g. between "Diverse" and "Excel-Tabellen"). – leandriis Aug 8 at 17:47
  • @leandriis I agree and used your suggestion in the second example. Thanks! – frougon Aug 8 at 19:48
4

Use two distinct tabular environments for the columns:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{array,booktabs}

\begin{document}

\begin{table}[htp]
\centering

\begin{tabular}{ll}
\toprule
\textbf{Primäre Quellen} & \textbf{Sekundäre Quellen} \\
\midrule
  \begin{tabular}[t]{@{}>{\raggedright\arraybackslash}p{5cm}@{}}
  Jira \\
  \addlinespace
  Confluence \\
  \addlinespace
  E-Mail \\
  \addlinespace
  Nextcloud \\
  \addlinespace
  Rocket.Chat \\
  \addlinespace
  GitLab/GitHub \\
  \end{tabular}
&
  \begin{tabular}[t]{@{}>{\raggedright\arraybackslash}p{5cm}@{}}
  exply \\
  \addlinespace
  Canias ERP \\
  \addlinespace
  Diverse Excel-Tabellen (Vertrieb, Verwaltung) \\
  \end{tabular}
\\
\bottomrule
\end{tabular}

\caption{Primäre und sekundäre Quellen bei XXXXXX}
\label{table:informationsquellen}

\end{table}

\end{document}

enter image description here

Be careful that \label should go after \caption. Using \arraystretch yields not very nice spaces, better using \addlinespace where needed.

3

To prevent the material in the two columns from interacting, you could place it into separate subordinated tabular environments. In the following solution, the "outer" tabular environment consists of two l columns; the outer environment is needed solely for the \toprule and \bottomrule directives. The "inner" tabular environments each contain a single p column, which allows automatic line-breaking (if needed).

I would also omit the vertical divider line.

enter image description here

\documentclass{article}
\usepackage{booktabs}

\begin{document}
\begin{table}[h!]
\renewcommand{\arraystretch}{1.5}
\centering
\footnotesize % is this really needed?
\begin{tabular}{ ll }  % "outer" tabular
  \toprule
  \begin{tabular}[t]{@{} p{5cm} @{}} % first "inner" tabular
    \textbf{Primäre Quellen} \\
    Jira        \\                  
    Confluence  \\              
    E-Mail      \\                             
    Nextcloud   \\               
    Rocket.Chat \\            
    GitLab/GitHub 
  \end{tabular} &          
  \begin{tabular}[t]{@{} p{5cm} @{}} % second "inner" tabular
    \textbf{Sekundäre Quellen} \\
    exply      \\
    Canias ERP \\
    Diverse Excel-Tabellen (Vertrieb, Verwaltung) 
  \end{tabular}\\
  \bottomrule
\end{tabular}
\caption{Primäre und sekundäre Quellen bei XXXXXX}
\label{table:informationsquellen}
\end{table}
\end{document}
  • 1
    A \\ seems to be missing after \textbf{Primäre Quellen}. – leandriis Aug 8 at 13:48
  • @leandriis - Thanks! Will fix right away. – Mico Aug 8 at 13:48
2

Here is a suggestion using two itemize environments instead of the tabular. If placed inside of a table this can float, get a cpation and be referenced as usual:

enter image description here

\documentclass{article}
\usepackage{booktabs}
\usepackage{enumitem}
\setlist{nosep}
\begin{document}

\begin{table}
\centering
\begin{minipage}[t]{3.5cm}
  \textbf{Primäre Quellen}
  \begin{itemize}[label={--}]
  \item Jira
  \item Confluence
  \item E-Mail
  \item Nextcloud
  \item Rocket.Chat
  \item GitLab/GitHub 
  \end{itemize}
\end{minipage}
\begin{minipage}[t]{5cm}\raggedright
  \textbf{Sekundäre Quellen}
  \begin{itemize}[label={--}]
  \item exply
  \item Canias ERP
  \item Diverse Excel-Tabellen (Vertrieb, Verwaltung)\\
  \end{itemize}
\end{minipage}
\caption{Primäre und sekundäre Quellen bei XXXXXX}\label{table:informationsquellen}
\end{table}
\end{document}

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.