2

When using nested enumerate environments, I am using the following syntax :

\documentclass{article}

\usepackage{enumitem}

\begin{document}
\begin{enumerate}[label*=\arabic*.]
\item A question
\stepcounter{enumi}
\begin{enumerate}[label*=\alph*.]
\item A subquestion.
\item Another subquestion.
\end{enumerate}
\end{enumerate}

\end{document}

which works just fine and displays exactly what I expect: enter image description here

However, with this other example,

\documentclass{article}

\usepackage{enumitem}

\begin{document}
\begin{enumerate}[label*=\arabic*.]
\stepcounter{enumi}
\begin{enumerate}[label*=\alph*.]
\item A subquestion.
\item Another subquestion.
\end{enumerate}
\end{enumerate}

\end{document}

I have a missing \item error, despite of an output corresponding to my expectations. What would be a correct way of proceeding in order to avoid such errors ?

And a related question (which would maybe deserve another topic): with TeXstudio, the second example does not display the PDF preview because of the compilation error, while with TeXmaker it does. Is there any way to display the PDF in case of (minor) compilation errors in TeXstudio ?

  • You just need at least one item in the outer list, before typesetting content or using a another list which in turn typesets some stuff. In my opinion, the subquestion number should coincide with the outer question number, the a), b) counting is quite good then. – user31729 Jul 21 '15 at 8:08
  • I've deleted my answer since it was apparently of no use to you, lacking the features you requested but not specified – user31729 Jul 21 '15 at 8:33
  • did you find an answer to this question? it's really bugging me as well. – Rayhunter Oct 17 '17 at 21:54
3

With a simple dummy item of no label \item[] {}, one can write this:

\documentclass{article}

\usepackage{enumitem}

\begin{document}

Some text ...    
\begin{enumerate}[label*=\arabic*.]
\item[] {}
\stepcounter{enumi}
\begin{enumerate}[label*=\alph*.]
\item A subquestion.
\item Another subquestion.
\end{enumerate}
\end{enumerate}
\end{document}

enter image description here

  • Wouldn't this leave to much space above the inner list? – user31729 Jul 21 '15 at 8:20
  • Thanks, this is exactly what I want. @ChristianHupfer : my complete document is by far more complex thant that and I've already added the necessary material to manage spaces. – mvienney Jul 21 '15 at 8:25
  • @mvienney: Your design decision then ... – user31729 Jul 21 '15 at 8:26
  • The space above the inner list can be controlled by setting topsep=0pt, for example, in the options for the outer list. – AboAmmar Jul 21 '15 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.