13

I need to have sections in an exam I am writing. The first 10 questions are multiple choice, which I would like to number simply 1-10. For the extended response, I would like to title the questions. Is there a way to do this in the exam class? Thank you for your help.

bbujeya
  • 611

2 Answers2

14

This is described in the documentation: You can use \titledquestion to assign a title to your question. In order for this title to be used in the question section, you also need to redefine the \qformat. The format changes only apply to the questions that come after the \qformat command, so you could first have the normal questions, then issue a \qformat to get the titles. To revert back to the simple style, you can use \noqformat.

Here's a simple example:

Exam with titled question

\documentclass{exam}
\begin{document}

\begin{questions}

\question[1]
What if I say I'm not like the others?
\begin{choices}
\choice You're the pretender
\choice I will never surrender
\end{choices}

\qformat{\thequestion. \textbf{\thequestiontitle} \hfill (\thepoints)}

\titledquestion{Complicated Long Question}[10] Identify all known unknowns and embrace complexity.

\noqformat
\question[1] Are you happy this is over?
\end{questions}

\end{document}
Jake
  • 232,450
  • I am ok having either titled questions or untitled questions. I would like to have both in the one document. What I was meaning to ask was: Can I just set titled questions for a specific section? – bbujeya Dec 16 '11 at 01:56
  • @user10082: The \qformat only applies to the questions that follow, so you can change the format at the beginning of the section. To remove the format, you can say \noqformat at the end of the section. I've edited my answer to give an example. – Jake Dec 16 '11 at 02:18
  • 1
    @cmhughes Possible answer might have been No one knows - Queens of the Stone Age. – percusse Dec 16 '11 at 03:18
  • I overlooked qformat in the manual. Thanks for mentioning it – Ludovic Kuty Jan 09 '16 at 11:14
0

You could also define a flexible version of qformat using the ifthen package so that you can mix titled and untitled questions in the same document without worrying about order or redefining qformat multiple times:

\usepackage{ifthen}
\qformat{\textbf{Question \thequestion 
    \ifthenelse{\equal{\thequestion}{\thequestiontitle}}
        {} % equality means title unset: do nothing
        {~(\thequestiontitle)} % there's a title, print it
    \hfill
    } % end textbf
}

Small working example:

\documentclass[a4paper,12pt]{exam}

\usepackage{ifthen} \qformat{\textbf{Question \thequestion \ifthenelse{\equal{\thequestion}{\thequestiontitle}} {} % equality means title unset: do nothing {~(\thequestiontitle)} % there's a title, print it \hfill } % end textbf }

\begin{document}

\begin{questions}

\titledquestion{I'm important enough to have a title} What is the meaning of life?

\question 2+2=5 ?

\titledquestion{Me too} Solve any of the millenium problems.

\end{questions}

\end{document}

enter image description here