I am starting to collaborate with colleagues who have exercise sheets which are actually a long list of exercises. Here 2 exercises (notice the second one has a title).
I find it ugly, but I can live with it.
However, it turns out that their LaTeX code for that indeed consists in a very big enumerate, where each exercise is an \item :
\begin{enumerate}
\item Beginning of first exercise.
Very long text......
\item Oh, the second exercise.
\suspend{enumerate}
Some text which is not an exercise.
\resume{enumerate}
\item An exercise.
\end{enumerate}
This is just filthy. I cannot work with this. For the code to be legible, I need each exercise to be in an environment.
\begin{exercise}
Beginning of first exercise.
Very long text......
\end{exercise}
\begin{exercise}
Second exercise.
\end{exercise}
Currently, I am using the following :
\usepackage{amsthm, thmtools}
\def\aLaLigne{\newline\leavevmode\null}
\let\finLigne\relax
\declaretheoremstyle[
notebraces={}{\global\let\finLigne\aLaLigne}, % hack because we want a line break iff there is a title to the exercise
notefont=\normalfont\sffamily,
headfont=\normalfont\bfseries,
bodyfont=\normalfont,
headpunct={.\finLigne\global\let\finLigne\relax},
headformat=margin,
headindent=3em
]{styleQuestion}
\declaretheorem[style=styleQuestion, title={}]{question}
\usepackage{enumitem}
\newlist{ssquest}{enumerate}{1}
\setlist[ssquest]{label=(\alph*)}
Which is almost right.
I still need to have the content of the exercise typeset with an increased left-margin, so it does not go to the left of the exercise number. Also, I have not yet managed to effectively break a line at the beginning when the content starts with a enumerate, despite using \leavevmode as per amsthm's doc.


ntheorempackage, which defines a\theoremindentlength and defines thechangestyle. – Bernard Aug 25 '22 at 10:35examdocument class, which has the ability to organize lists of exercises. If you gine us some more details we may help you suggesting more specific solutions. – miltos Aug 25 '22 at 12:38