1

I would like to make a table where I can add 1em of space after many (but not all) rows. The rows vary in height (because they contain content of varying lengths). I am attempting to add the extra space by "adding glue" (I think that's the term) after each line break, i.e., \\ [1em].

This used to work, on my older computer (I think MacTeX 2016), but now that I've installed LaTeX on my new machine (MacTeX 2018), this isn't working. So maybe I've installed something wrong, or am using a different version of something...

What this seems to do is add 1em of space from the bottom of the first line of each row, so if the row is only one line high to begin with, nothing appears to happen.

Can anyone shed light on what is happening here, and suggest a solution? Thank you!

MWE:

\documentclass[letterpaper,11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{longtable}
\usepackage{tabu}

\newcolumntype{L}{>{\raggedright}p{1in}}
\newcolumntype{R}{>{\raggedright\arraybackslash}p{5.5in}}

\begin{document}

\begin{longtable}{ @{} L @{} R @{} }

One & Long entry, long enough to span two lines! Long entry, long enough to span two lines! Long entry, long enough to span two lines! \\ [1em]

Two & Entry that only spans one line, correctly has 1em space after it. \\ [1em]

Three & Long entry, long enough to actually span three lines! Long entry, long enough to actually span three lines! Long entry, long enough to actually span three lines! Long entry, long enough to actually span three lines! \\ [1em]

Four & Another short entry... \\

\end{longtable}

\end{document}

For me, this looks like:

enter image description here

  • Did you mean you would like to have the kind of spacing like the second and third rows do? – zyy Dec 10 '18 at 23:55
2

If you wanted the space for all rows, simplest not to use the \\ optional argument but to adjust the table spacing eg

\documentclass[letterpaper,11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{longtable}
%\usepackage{tabu}
\usepackage{array,}

\newcolumntype{L}{>{\raggedright}p{1in}}
\newcolumntype{R}{>{\raggedright\arraybackslash}p{5.5in}}

\begin{document}

\setlength\extrarowheight{1em}
\begin{longtable}{ @{} L @{} R @{} }

One & Long entry, long enough to span two lines! Long entry, long enough to span two lines! Long entry, long enough to span two lines! \\ 

Two & Entry that only spans one line, correctly has 1em space after it. \\ 

Three & Long entry, long enough to actually span three lines! Long entry, long enough to actually span three lines! Long entry, long enough to actually span three lines! Long entry, long enough to actually span three lines! \\ [1em]

Four & Another short entry... \\

\end{longtable}

\end{document}

For one-off spacing adjustments teh \addlinespace command from booktabs could be used

\documentclass[letterpaper,11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{longtable}
%\usepackage{tabu}
\usepackage{array,booktabs}

\newcolumntype{L}{>{\raggedright}p{1in}}
\newcolumntype{R}{>{\raggedright\arraybackslash}p{5.5in}}

\begin{document}

\begin{longtable}{ @{} L @{} R @{} }

One & Long entry, long enough to span two lines! Long entry, long enough to span two lines! Long entry, long enough to span two lines! \\ 

\addlinespace[1em]

Two & Entry that only spans one line, correctly has 1em space after it. \\ 

\addlinespace[1em]

Three & Long entry, long enough to actually span three lines! Long entry, long enough to actually span three lines! Long entry, long enough to actually span three lines! Long entry, long enough to actually span three lines! \\ 

Four & Another short entry... \\

\end{longtable}

\end{document}
  • \addlinespace is exactly what I needed! Unfortunately the first solution doesn't work in this case because I only need to add spacing to ~40% of rows. – Tim Gorichanaz Dec 11 '18 at 0:43
2

You can use \addlinespace from booktabs, setting (locally) its default value to 1em:

\documentclass[letterpaper, 11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{longtable,booktabs}
\usepackage{tabu}

\newcolumntype{L}{>{\raggedright}p{1in}}
\newcolumntype{R}{>{\raggedright\arraybackslash}p{5.5in}}

\begin{document}
{\setlength{\defaultaddspace}{1em}
\begin{longtable}{ @{} L @{} R @{} }

One & Long entry, long enough to span two lines! Long entry, long enough to span two lines! Long entry, long enough to span two lines! \\
\addlinespace

Two & Entry that only spans one line, correctly has 1em space after it. \\ [1em]

Three & Long entry, long enough to actually span three lines! Long entry, long enough to actually span three lines! Long entry, long enoughto actually span three lines! Long entry, long enough to actually span three lines!
\\
\addlinespace

Four & Another short entry... \\

\end{longtable}
}
\end{document} 

enter image description here

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.