# Compilation error when including enumitem and paralist packages

I encounter an error when I compile a LaTeX document which includes both the enumitem and the paralist packages. Here is my MWE code:

\documentclass{article}

\usepackage{enumitem}
\usepackage{paralist}

\begin{document}

\begin{tabular}{lp{10cm}}
\scshape Assume: & \begin{compactenum}
\item $(p_1, p_2)$ is an optimal price sequence
\item $p_2 > p_1 > 0$
\end{enum}
\\
\scshape Prove: & False
\end{tabular}

\begin{enumerate}[label=\bfseries Case \arabic*:,leftmargin=*]
\item
It rains today.
\item
It does not rain today.
\end{enumerate}

\end{document}


How do I fix the error? Is there a way to define my own compactenum using enumitem so I don't need to include the paralist package?

-

You don;t need to use the paralist package at all. Just use the starred variant of the environments from the enumitem package -- requires to add the inline option to the enumitem package:

If you don't want the enumerat in the tabular to be on its own line you can tweak all the paramaters used for vertical spacing. Below I used [topsep=0pt,partopsep=0pt,itemsep=0pt, parsep=0pt] to achieve:

## Compilation Error

You original compilation error can be fixed via:

1. Load paralist before enumitem.
2. Replace the \end{cenum} with \end{compactenum}

## Code: inline

\documentclass{article}

\usepackage[inline]{enumitem}
%\usepackage{paralist}

\begin{document}

\begin{tabular}{lp{10cm}}
\scshape Assume: & \begin{enumerate*}
\item $(p_1, p_2)$ is an optimal price sequence
\item $p_2 > p_1 > 0$
\end{enumerate*}
\\
\scshape Prove: & False
\end{tabular}

\begin{enumerate}[label=\bfseries Case \arabic*:,leftmargin=*]
\item
It rains today.
\item
It does not rain today.
\end{enumerate}

\end{document}


## Code: Tight Spacing:

\documentclass{article}

\usepackage{enumitem}
%\usepackage{paralist}

\begin{document}

\begin{tabular}{lp{10cm}}
\scshape Assume: & \begin{enumerate}[topsep=0pt,partopsep=0pt,itemsep=0pt, parsep=0pt]
\item $(p_1, p_2)$ is an optimal price sequence
\item $p_2 > p_1 > 0$
\end{enumerate}
\\
\scshape Prove: & False
\end{tabular}

\begin{enumerate}[label=\bfseries Case \arabic*:,leftmargin=*]
\item
It rains today.
\item
It does not rain today.
\end{enumerate}

\end{document}


## Code: Fix Compilation Error

\documentclass{article}

\usepackage{paralist}
\usepackage{enumitem}

\begin{document}

\begin{tabular}{lp{10cm}}
\scshape Assume: & \begin{compactenum}
\item $(p_1, p_2)$ is an optimal price sequence
\item $p_2 > p_1 > 0$
\end{compactenum}
\\
\scshape Prove: & False
\end{tabular}

\begin{enumerate}[label={\bfseries Case \arabic*:},leftmargin=*]
\item
It rains today.
\item
It does not rain today.
\end{enumerate}

\end{document}

-
Thank you for your answer. However, I do not want the enumerate in the tabluar to be inline. –  I Like to Code Feb 27 '14 at 21:52

Your example compiles fine if I reverse the order of loading paralist and enumitem and change \end{enum} to \end{compactenum}. I don't know if that does what you want, however. Note: when packages conflict, one of the things to try is a change in load order.

On the other hand, a compactenum environment can be defined with the facilities of the enumerate package alone, making paralist possibly unnecessary:

\documentclass{article}
\usepackage{enumitem}
\newenvironment{compactenum}{%
\enumerate[topsep=0pt,partopsep=0pt,parsep=0pt,itemsep=0pt]%
}{\endenumerate}
\begin{document}
\begin{tabular}{lp{10cm}}
\scshape Assume: &
\begin{compactenum}
\item $(p_1, p_2)$ is an optimal price sequence
\item $p_2 > p_1 > 0$
\end{compactenum}
\\
\scshape Prove: & False
\end{tabular}

\begin{enumerate}[label=\bfseries Case \arabic*:,leftmargin=*]
\item  It rains today.
\item  It does not rain today.
\end{enumerate}
\end{document}


One might want to give a little stretchability to the four values set to 0pt in the \enumerate command. That is, replace 0pt with 0pt plus 1pt or possible \parskip.

-
You might as well use \newlist to define compactenum, which will have more flexibility. –  Peter Grill Feb 27 '14 at 22:30
@PeterGrill It wasn't clear to me from the documentation how to use \newlist. It seems I would also need \setlist to add the 0pt settings (but I didn't have time to test all that). –  Dan Feb 27 '14 at 23:19
Why not just use nosep to kill the vertical spacing rather than specifying it explicitly? (Sec. 3.8 of enumitem's documentation: 'Compact Lists'.) Is less typing, though obviously no better (or worse) than your definition. –  cfr Feb 28 '14 at 0:33

This builds on the answers from Dan and Peter Grill. Just to show the way in which enumitem can be used to create a new list with the required properties. I've called this mycompactenum so that I can include compactenum from paralist for comparison in the same document but obviously you can just use compactenum if you wanted to do it this way. This solution also uses enumitem's nosep option to kill the vertical spacing. This is equivalent to setting all of partopsep, topsep, itemsep and parsep to zero.

\documentclass{article}
\usepackage{paralist}
\usepackage{enumitem}
\newlist{mycompactenum}{enumerate}{1}
\setlist[mycompactenum,1]{nosep,label=\arabic*.}
\begin{document}
\marginpar{\texttt{paralist}}
\begin{tabular}{lp{10cm}}
\scshape Assume: &
\begin{compactenum}
\item $(p_1, p_2)$ is an optimal price sequence
\item $p_2 > p_1 > 0$
\end{compactenum}
\\
\scshape Prove: & False
\end{tabular}\bigskip

\marginpar{\texttt{enumitem}}
\begin{tabular}{lp{10cm}}
\scshape Assume: &
\begin{mycompactenum}
\item $(p_1, p_2)$ is an optimal price sequence
\item $p_2 > p_1 > 0$
\end{mycompactenum}
\\
\scshape Prove: & False
\end{tabular}

\begin{enumerate}[label=\bfseries Case \arabic*:,leftmargin=*]
\item  It rains today.
\item  It does not rain today.
\end{enumerate}
\end{document}


Here's the output:

-