6

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

8

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

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.