Text FormattingSet question and part number in Exam class

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Set question and part number in Exam class

Post by Singularity »

How best can I number the following MWE to question 9b?

I am using the exam class. I am adding an additional question to a quiz, so I want to number it as question 9b. I see from here how to set the question number. But, it won't let me create question 9b (probably because question number must be numeric).

So I numbered the question 9 and added parts. Now I want the part to start as b. But I cannot find anything in the exam's documentation on how to set the part number. In fact, I can't find anything which discusses how to set the question number (which would lead me to the area on how to set the part number).

So, part (b): where did you find how to do that in exam's documentation, so I don't have to ask questions every single time I need to do something.

Code: Select all

\documentclass[fleqn,addpoints
%,answers
]{exam}
\usepackage{color}					% Necessary for \shaded solutions
\usepackage{polynom}

\shadedsolutions
\bracketedpoints
\pointpoints{pt}{pts}
\everymath{\displaystyle}
\begin{document}

\begin{questions}
\setcounter{question}{8}
%\setcounter{part}{b}
\question[5] 
\begin{parts}
\part Divide $v^6+1$ by $v-1$.
\begin{solution}
	\polylongdiv{x^6+1}{x-1}
\end{solution}
\end{parts}
\end{questions}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Set question and part number in Exam class

Post by Johannes_B »

Counters always have a numerical value, just the output changes. \begin{parts} will reset the counter for parts (partno), so setting the counter has to after starting the parts.

Code: Select all

\documentclass[fleqn,addpoints
%,answers
]{exam}
\begin{document}

\begin{questions}
\setcounter{question}{8}
\question[5]
\begin{parts}
\setcounter{partno}{1}%%Setting the counter
\part Divide $v^6+1$ by $v-1$.
\begin{solution}
	Solution
\end{solution}
\end{parts}
\end{questions}
\end{document}
Where or how to find it? I simpply scrolled the toc of the documentation, and »Customizing the numbers« caught my eyes. And there is the relevant counter (partno).
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Set question and part number in Exam class

Post by Singularity »

Johannes_B wrote:..
Where or how to find it? I simpply scrolled the toc of the documentation, and »Customizing the numbers« caught my eyes. And there is the relevant counter (partno).
I read that section, but I didn't understand the key sentence (I'm going to blame the strange spacing).
Post Reply