# Using display equations in inline lists with enumitem

I am trying to create in-line lists in LaTeX, and this works wonderfully well using the enumitem package.

But if I want to place a displayed equation (which would not be often for inline lists... but I need to sometimes) an error is generated.

A MWE:

\documentclass{article}

\usepackage[inline]{enumitem}

\newlist{enumerateIL}{enumerate*}{1}%
% Inline enumeration environment

\setlist[enumerateIL,1]{font=\itshape\bfseries,label={\arabic*.}}
% Format itemize \item's

\begin{document}

An in-line list:
\begin{enumerateIL}
\item
The first point:
$a + b = c$.

\item
The second point
$a^2 + b^2 = c^2.$

\end{enumerateIL}

\end{document}


I get this compilation error

:
! Missing $inserted. <inserted text>$
l.21    $a^ 2 + b^2 = c^2.$


As suggested by the error message, in line equations work OK... but not displayed equations.

Is there a way of making this work with enumitem? If not, is there an alternative for me to look at?

Thanks.

P.

• How do you want these to be handled? In my opinion, you should just use $\displaystyle ...$ instead of $...$. – Werner Oct 7 '16 at 1:59
• Use the option mode=unboxed. – Javier Bezos Nov 7 '16 at 14:51
• @JavierBezos Can you provide an answer, please? – egreg Dec 7 '16 at 13:58

Answer due to the comment by @JavierBezos changing the mode to unboxed:

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

\begin{document}
text before inline itemize environment
\begin{enumerate*}[mode=unboxed]
\item this is an inline itemize environment with math environment
$$E= mc^2$$
\end{enumerate*}
\end{document}


Here I use manual linebreaks with extra space \\[5pt] to set off the equation, and use $\displaystyle...$to set the equation in a full-width text box.

\documentclass{article}

\usepackage[inline]{enumitem}

\newlist{enumerateIL}{enumerate*}{1}%
% Inline enumeration environment

\setlist[enumerateIL,1]{font=\itshape\bfseries,label={\arabic*.}}
% Format itemize \item's

\begin{document}

An in-line list:
\begin{enumerateIL}
\item
The first point:
$a + b = c$.

\item
The second point\\[5pt]
\makebox[\linewidth]{$\displaystyle \frac{x}{a^2} + b^2 = c^2.$}\\[5pt]
More stuff
\item
More stuff More stuff More stuff More stuff More stuff More stuff
More stuff More stuff More stuff More stuff More stuff More stuff
More stuff More stuff More stuff More stuff

\end{enumerateIL}

\end{document}


This can be automated with the following preamble addition:

\usepackage{environ}
\NewEnviron{enumILeqn}{\\[5pt]\makebox[\linewidth]{$\displaystyle\BODY$}\\[5pt]}


and usage as

The second point

\begin{enumILeqn}
\frac{x}{a^2} + b^2 = c^2
\end{enumILeqn}

More stuff


I am currently getting around the issue using $\displaystyle...$ but, of course, that keeps the maths inline and does not generate a centred, displayed equation which I am hoping for. I sometime have quite complicated equations I wish to use, for which \$\displaystyle... sometimes isn't good enough.

• It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The Stack Exchange staff can merge them together for you. – Werner Oct 8 '16 at 10:48