1

I use the exercise package for typesetting exercises and questions. After a new part the (sub)question counter is reseted. I would to avoid this but I don't know how.

MVE

\documentclass[11pt]{article}
\usepackage{exercise}

\begin{document}

\begin{Exercise}
\ExePart{Second part}
\Question ABCD
\Question EFGH
\ExePart{Second part}
\Question IJK
\end{Exercise}


\end{document}
3

The \Question command eventually executes \@@@Question, which starts up a \list, with parameters \usecounter{Question} and this resets the counter to 0. Also \@InitExePart does the resetting; we need to cope with both.

\documentclass[11pt]{article}
\usepackage{exercise}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\@InitExePart}{\setcounter{Question}{0}}{}{}{}
\patchcmd{\@@@Question}{\usecounter}{\nonresettingusecounter}{}{}
\def\nonresettingusecounter#1{%
  \@nmbrlisttrue
  \def\@listctr{#1}%
}
\makeatother

\begin{document}

\begin{Exercise}
\ExePart{First part}
\Question ABCD
\Question EFGH
\ExePart{Second part}
\Question IJK
\end{Exercise}

\end{document}

enter image description here

|improve this answer|||||

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.