3

Please take a look on the following example:

\documentclass[a4paper]{article}

\begin{document}
\begin{tabular}{ |p{ \textwidth}| } 

\hline
\begin{enumerate}
    \item Item in a list
\end{enumerate} \\

\hline
Item not in a list \\
\hline
\end{tabular} 
\end{document}

The "Item in a list" has an extra spacing at top and bottom inside a table cell in comparison to "Item not in a list".

How to reduce this top and bottom spacing?

David Carlisle
  • 757,742
ovk
  • 535

2 Answers2

4

I tried

\usepackage{paralist}

and then

\begin{inparaenum}
\item Item in a list\par
\item Item in a list
\end{inparaenum}\\

The explicit \par looks really weird, but with all other enumerate constructs provided by paralist, the extra spacing was still there.

3

Using enumitem:

Taking a hint form Stephan Lehmke, with the enumitem package you could use the inline enumerate* environment (assuming you have a single item):

enter image description here

The enumitem package also includes a resume option which would be useful if you wanted to resume the list in a different row.

References:

Code:

\documentclass{article}
\usepackage[inline]{enumitem}

\begin{document} \begin{tabular}{ |p{ \textwidth}| }

\hline \begin{enumerate} \item Item in a list \end{enumerate} \

\hline Item not in a list \ \hline \end{tabular} \end{document}


Using a Counter:

Alternatively, you could just use your own counter which yields results identical to above:

\documentclass{article}

\newcounter{MyCounter}% \newcommand*{\MyItem}{\refstepcounter{MyCounter}\theMyCounter.~}%

\begin{document} \begin{tabular}{ |p{ \textwidth}| }

\hline \MyItem Item in a list\ \hline Item not in a list \ \hline \end{tabular} \end{document}

Peter Grill
  • 223,288