Assume I have a text with double spacing. Now to visualize table cell wrap (automated table cell wrap is not possible in Latex as far as I know), I want to space this "cell wrap" with single spacing. "Real new lines" of the table still keep double spacing ("the default" eg defined in class).
How to do this? I tried setting \singlespacing within the table. However this does not work (complaining about missing endGroup).
I found out how to turn the whole table to singlespacing (bringing this singlespacing group outside the table), however I still want to use doublespacing for 'new table lines'.
PS: I do not want a line to visualize breaks in a table.
Screenshot and MWE attached:
MWE
\documentclass{article}
\usepackage{setspace}
\usepackage{booktabs}
\begin{document}
\doublespacing
\section{Text}
Test2\\
Test1
\section{Table}
\begin{tabular}{ll}
\toprule
\textbf{Key} & \textbf{Value} \\
\midrule
Category & Line1 \\
LongLabel: & Line2 \\
Category2: & Line1 \\
& Line2 \\
\bottomrule
\end{tabular}
\end{document}
Best Answer
You can define command to be added before and after environment definitions so you can manually add
\begin{singlespace}
before your\begin{tabular}
and\end{singlespace}
after your\end{tabular}
.Alternatively, using the
etoolbox
package, you can add a couple of lines in your preamble that will do this for you every time you add a table. You can then specify the spacing by hand for the one you want to be bigger with the optional\\[height]
: