3

When using the parts environment in the exam class, along with the \answerline command, the part number is listed twice, once before the part question and once before the part answerline.

If I don't need to say anything in the part question, is there a way to suppress the part number being typeset there?

If I don't use the parts environment at all and just use multiple \answerline commands they are all numbered with the questions number.

\documentclass{exam}
\begin{document}
  \begin{questions}
    \question Name two colors.
    \begin{parts}
      % nothing to say in the parts
      \part\answerline
      \part\answerline
    \end{parts}
  \end{questions}
\end{document}

The above code shows sort of what I'm doing. I want the \answerline commands to have (a) and (b) but the \part commands also have (a) and (b) which I don't want.

Thanks!

0

2 Answers 2

1

Add the following two lines to your preamble.

\newcommand\stoplabeling{\def\makelabel##1{}}
\newcommand\resumelabeling{\def\makelabel##1{\hss\llap{##1}}}

Then you can start and stop labeling by inserting these two commands in any list environment that uses \item.

enter image description here

\documentclass{exam}
\newcommand\stoplabeling{\def\makelabel##1{}}
\newcommand\resumelabeling{\def\makelabel##1{\hss\llap{##1}}}
\begin{document}
  \begin{questions}
    \question Name two colors.
    \begin{parts}
      \stoplabeling
      % nothing to say in the parts
      \part \answerline
      \part \answerline
      \resumelabeling
      \part Do you know another one? \answerline
    \end{parts}
  \end{questions}
Also works with other lists, like itemize.
\begin{itemize}
\item Marked item
\stoplabeling
\item Unmarked item with an enumerated list in it.
   \begin{enumerate}
     \item Marks are again active within every new list.
   \end{enumerate}
\item Another unmarked item: on the outer level still no label.
\resumelabeling
\item Marked item, since labeling has been resumed.
\end{itemize}
\end{document}
1
  • amazing! perfect.
    – Andy
    Jan 5, 2017 at 16:48
0

I have no good idea.

I tried to manipulate the counter partnumber (I found in the source code), but didn't suceed.

A workaround could be:

\documentclass{exam}
\begin{document}
  \begin{questions}
    \question Define two colors
    \begin{enumerate}
    \item \hrulefill
    \item \hrulefill
    \end{enumerate}
\end{document}

Resulting in

enter image description here

Of course, you can fill in a \strut or change the itemsep distance, to give some room for a handwritten text.

3
  • I think that will work since i generally don't separate my points down to the part level. Thanks!
    – Andy
    Jan 5, 2017 at 16:21
  • @Andy: You are welcome! If it worked for you, you might mark it solved.
    – Jan
    Jan 5, 2017 at 16:24
  • How is \thequestion defined? Try inside the document \meaning\thequestion and look after something like \thepartnumber.\arabic{question}...
    – user31729
    Jan 5, 2017 at 16:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .