Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

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}
share|improve this question
add comment

marked as duplicate by mafp, Andrew Swann, Kurt, Marco Daniel, Claudio Fiandrino Apr 18 '13 at 16:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 3 down vote accepted

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
...
share|improve this answer
    
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
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.