# Prevent linebreak before enumerate

I switched from a proof environment to a custom one, if I begin the custom environment with an enumerate, there is a linebreak that I'd like to prevent. The MWE shows the difference between the proof environment and ex. I tried playing with spacings, and /nobreak, to no avail.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{amsmath,amsfonts}

%% Packages
\usepackage{amsmath,amsfonts}
\usepackage{amsthm}
\usepackage[matha,mathb]{mathabx}
\usepackage[shortlabels]{enumitem}

%% Custom environments/macros
\newcounter{exnum}[section]
\newenvironment{ex}
{\stepcounter{exnum}\paragraph{Exercice \thesection.\theexnum.}}
{\hfill$$\Box$$}

\begin{document}

\section{Section 1}
\begin{ex}
\begin{enumerate}[(a),wide=0pt]
\item foo
\end{enumerate}
\end{ex}

\begin{proof}
\begin{enumerate}[(a),wide=0pt]
\item foo
\end{enumerate}
\end{proof}

\end{document}


Is this an acceptable solution? The line is not being broken after the item in the trivlist (actually, the solution is stolen from the amsthm)

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{amsmath,amsfonts}

%% Packages
\usepackage{amsmath,amsfonts}
\usepackage{amsthm}
\usepackage[matha,mathb]{mathabx}
\usepackage[shortlabels]{enumitem}

%% Custom environments/macros
\newcounter{exnum}[section]

\newenvironment{ex}
{\stepcounter{exnum}%
\trivlist\item[\bfseries Exercice \thesection.\theexnum.]\ignorespaces}
{\hfill$$\Box$$\endtrivlist}

\begin{document}

\section{Section 1}
\begin{ex}
\begin{enumerate}[(a),wide=0pt]
\item foo
\end{enumerate}
\end{ex}

\end{document}

• Yes, this works very well. I should've looked for the source code of the proof environment. There seems to be quite a bit to do with trivlists, especially when defining custom theorem-like environments. Thanks! – zuggg Nov 21 '14 at 19:25

If you invoke the inline option to enumitem, then using enumerate* instead of enumerate gives you inline lists:

## Code:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{amsmath,amsfonts}

%% Packages
\usepackage{amsmath,amsfonts}
\usepackage{amsthm}
\usepackage[matha,mathb]{mathabx}
\usepackage[shortlabels,inline]{enumitem}

%% Custom environments/macros
\newcounter{exnum}[section]
\newenvironment{ex}
{\stepcounter{exnum}\paragraph{Exercice \thesection.\theexnum.}}
{\hfill$$\Box$$}

\begin{document}

\section{Section 1}
\begin{ex}
\begin{enumerate*}[(a),wide=0pt]
\item foo
\end{enumerate*}
\end{ex}

\begin{proof}
\begin{enumerate}[(a),wide=0pt]
\item foo
\end{enumerate}
\end{proof}

\end{document}

• This would be a good workaround if the items are small, but in my case (which I did not specify), they are not. Also, I'd prefer for the following items to be on a new line rather than inline. Sorry for not being specific enough. – zuggg Nov 21 '14 at 19:30