5

My problem with the following example:

  • If there is text after a list (itemize), everything looks just fine.
  • If there isn't, there is a blank line after the last list item which I would like to remove.

In my document the table has more columns but those are not relevant to the problem I think (in case you wonder why I would use a table at all).

\documentclass[parskip=half]{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[english, ngerman]{babel}
\usepackage{tabularx}
\usepackage{enumitem}
\setlist{nolistsep}

\begin{document}

\begin{tabularx}{\textwidth}{X}
 \begin{itemize} 
  \item text 
 \end{itemize} 
 more text \\ 
 \hline
 \begin{itemize} 
  \item text 
 \end{itemize} \\ 
 \hline
\end{tabularx}

\end{document}
lockstep
  • 250,273
Jens
  • 153

1 Answers1

3

this is a hack, and i don't really like it, but you can put an explicit negative space after the \\ that follows the "no text" condition as in the following code:

...
\hline
\begin{itemize} 
 \item text 
\end{itemize} \\[-\normalbaselineskip]
\hline
...
  • I left "I only use code I like" a long time ago when it comes to latex... Thank you! – Jens Aug 28 '12 at 13:53
  • egreg's solution here is much better: try \begin{tabularx}{\textwidth}{|X|}, i.e., with vertical lines, to see why. – mafp Apr 18 '13 at 15:32