# How to use exercise.sty for an exercise with several questions

This should be easy, but I just cannot figure it out reading the documentation. Somehow I get confused by all this Exercise/ExePart/subQuestion, etc.

Basically I want to typeset an exercise which consists of an introduction followed by several enumerated questions. So in the end it should look something like:

Ex. 1 - Some longish introductory text to a very difficult Exercise
blablablabla tralala....

1. The first question
2. The second question
...


Since this is part of an ExerciseList environment I tried the following:

\documentclass{article}
\usepackage[lastexercise]{exercise}
\begin{document}
\begin{ExerciseList}
\Exercise Some longish introductory text to a very difficult Exercise blablablabla tralala....

\Question The first question
\Question The second question
\end{ExerciseList}
\end{document}


However this does not work. Only the first question appears in the output and all subsequent questions are not visible. How can I fix this?

• I don't know why but if you use only one \Answer at the end, all \Questions are shown. – Ignasi Jan 17 '18 at 10:53
• Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Skillmon Jan 17 '18 at 11:21
• With the MWE in the qustion, I can not reproduce the described problem. For me, all questions and answers appear in the resulting pdf, although both are numbered with 1. – leandriis Jan 17 '18 at 13:06
• @leandriis add a noanswer to the package options to reproduce the described behaviour. – Skillmon Jan 17 '18 at 13:17

The following is how I understand the package's documentation, so there might be errors in what I write here.

First of: The \Answer is only an answer to an \Exercise, not a \Question.

The enumeration of \Questions only works if they follow each other (without an \Answer or \Exercise in between).

If \Questions follows an \Exercise with no \Answer in between they are considered belonging to the \Exercise, if they follow an \Answer they belong to that \Answer. That's why if you include the option noanswer the second \Question isn't displayed.

So how would I generate your stuff? Like this:

\documentclass{article}
\usepackage[lastexercise]{exercise}
\begin{document}
\begin{ExerciseList}
\Exercise Some longish introductory text to a very difficult Exercise blablablabla tralala....
\Question The first question
\Question The second question

I guess that's the way you should use the ExerciseList. That's the result (without noanswer):