[Tex/LaTex] \newline not working with booktabs

line-breakingtables

A while ago I had a question about having multi-line strings in a table cell (
in-cell newlines (in tabular environments)?).

I remember seeing it working but I've just tried to use it again and … \newline did nothing.

A test LaTeX source is below, which, despite the \newline commands, it did not split the cells on multiple lines:

alt text

\documentclass[12pt,titlepage]{article}
\RequirePackage[l2tabu,orthodox]{nag}
\usepackage[english]{babel}
\usepackage{pslatex}
\usepackage{setspace}
\setstretch{1.6}
\usepackage{booktabs}
\usepackage[final,babel]{microtype}
\usepackage[detect-all]{siunitx}
\setlist{nolistsep}
\frenchspacing

\begin{table}[htp]
    \centering
    \begin{tabular}{@{}l l l l@{}}
          \toprule
           & \textbf{Foo} & {\textbf{Bar}} & \textbf{Baz} \\
          \midrule
            \textbf{Single line} & foo1 foo2 & bar1 bar2 & baz1 baz2 \\
            \textbf{Multiline} & foo1 \newline foo2 & bar1 \newline bar2 & baz1 \newline baz2 \\
          \bottomrule
    \end{tabular}
    \caption {\small{bla bla}}\label{my-label}
\vspace*{-3mm}
\end{table}

Best Answer

Use tabular p specifier instead of l.

\documentclass{article}
\begin{document}
\begin{tabular}{@{}l p{2cm}p{3cm}p{3cm}@{}}
    & \textbf{Foo} & {\textbf{Bar}} & \textbf{Baz} \\
    \textbf{Single line} & foo1 foo2 & bar1 bar2 & baz1 baz2 \\
    \textbf{Multiline} & foo1 \newline foo2 & bar1 \newline bar2 & baz1 \newline baz2 \\
\end{tabular}
\end{document}