[Tex/LaTex] Single item list based off enumerate

enumitem

I have a successful questions environment that is based off of the enumerate environment using the enumitem package. It correctly continues numbering from the previous questions environments.

What I want is a question environment that mimics exactly the behavior of a questions environment with a single item. The following is my attempt, which I hoped would produce labels 1,2,3,4,5. Instead it produces labels 1,1,2,3,3.

\documentclass{article}
\usepackage{enumitem}
\newlist{questions}{enumerate}{2}
\setlist[questions,1]{label=\arabic*.,resume}
\newenvironment{question}{\begin{questions} \item }{\end{questions}}
\begin{document}
\begin{question}
    One
\end{question}
\begin{questions}
    \item Two
\end{questions}
\begin{questions}
    \item Three
\end{questions}
\begin{question}
    Four
\end{question}
\begin{question}
    Five
\end{question}
\end{document}

How would I create a question environment (a single item list) that has compatible label numbering with the questions environment?

Best Answer

It is not exactly clear what you are trying to do, but when you use resume a list you need to specify a name for what you want to resume. So, in the first instance you specify the name via series=MyQuestion, and then for subsequent list items you resume it via resume=MyQuestion:

enter image description here

Code:

\documentclass{article}
\usepackage{enumitem}
\newlist{questions}{enumerate}{2}
\setlist[questions,1]{label=\arabic*.,resume=MyQuestion}
\newenvironment{question}{\begin{questions}[series=MyQuestion] \item }{\end{questions}}
\begin{document}
\begin{question}
    One
\end{question}
\begin{questions}
    \item Two
\end{questions}
\begin{questions}
    \item Three
\end{questions}
\begin{question}
    Four
\end{question}
\begin{question}
    Five
\end{question}
\end{document}
Related Question