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.

I have several longtables in one document and they all have a fairly big gap before the first item and after the last item of every enumerate-list. Does anyone know how to get rid of that?

\documentclass[11pt,a4paper]{article}

\usepackage{longtable}

\begin{document}

\begin{longtable}{c|p{10cm}}
    \hline
    \textbf{test} & \textbf{test}\\
    \hline
    \hline
    test          &  
       \begin{enumerate}
          \item test
          \item test
       \end{enumerate} \\
    \hline

\end{longtable}

\end{document}

output

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Explicitly embed the enumerate environment inside a minipage environment.

\documentclass[11pt,a4paper]{article}
\usepackage{longtable}
\begin{document}

\begin{longtable}{c|p{10cm}}\hline
\textbf{test} & \textbf{test}   \\\hline\hline
test          &  
  \begin{minipage}[t]{10cm}
   \begin{enumerate}
      \item test
      \item test
   \end{enumerate} 
  \end{minipage}
  \\\hline
\end{longtable}

\end{document}

enter image description here

But that result is a bit unsatisfactory. Adding a bit of spacing before and after can make a better presentation. This can be done by changing the parameters that control the enumerate environment. The enumitem package allows easier control.

\documentclass[11pt,a4paper]{article}
\usepackage{longtable}
\usepackage{enumitem}
\begin{document}

\begin{longtable}{c|p{10cm}}\hline
\textbf{test} & \textbf{test}   \\\hline\hline
test          &  
  \begin{minipage}[t]{10cm}
     \begin{enumerate}[topsep=0.25ex,leftmargin=*]
        \item test
        \item test
     \end{enumerate} 
     \vspace{0pt}
  \end{minipage}
  \\\hline
\end{longtable}

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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