TransWikia.com

How can I resume the part numbering in exam document class?

TeX - LaTeX Asked on August 29, 2021

For enumerate there are options like start or resume or commands like setcounter{enumi}{4} or addtocounter{enumi}{41} as discussed in questions like How can I make an enumerate list start at something other than 1? or Resuming a list.

Are there analogous possibilities for the parts environment in the exam document class?

documentclass{exam} 

begin{document}
begin{questions}
question[10]
Some not indented text
begin{parts}
    part this should be (a)
    part this should be (b)
end{parts}
Some more not indented text interrupting the parts
begin{parts}
    part this should be (c)
    part this should be (d)
end{parts}
end{questions}
end{document}

One Answer

setcounter{partno}{3} or addtocounter{partno}{5} are possibilities (inspired by https://tex.stackexchange.com/a/81720/128042), but a bit less elegant than the automatic resume option for enumerate.

https://tex.stackexchange.com/a/1702/128042 would be slightly less hard codes but a bit more code:

documentclass{exam} 
newcounter{nameOfYourChoice}
begin{document}
begin{questions}
question[10]
Some not indented text
begin{parts}
    part this should be (a)
    part this should be (b)
    setcounter{nameOfYourChoice}{value{partno}}
end{parts}
Some more not indented text interrupting the parts
begin{parts}setcounter{partno}{value{nameOfYourChoice}}
    part this should be (c)
    part this should be (d)
end{parts}
end{questions}
end{document}

Answered by Jakob on August 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP