Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to create an multiple choices question with this indenting format

1. ########
   A. ###
   B. ###
   C. ###
2. ########
   ########
   A. ###
   B. ###
   C. ###

The choices have same indentation as the question text.

But, using the default exam documentclass, I get this format

1. ########
     A. ###
     B. ###
     C. ###
2. ########
   ########
     A. ###
     B. ###
     C. ###

Hence, I try to set the \leftmargin to 0pt inside the choices environment to get what I want.

\documentclass{exam}
\begin{document}
\begin{questions}
  \question
  How old are you?
  \begin{choices}
    \setlength{\leftmargin}{0pt}
    \choice 14
    \choice 17
    \choice 19
    \choice 20
    \choice 23
  \end{choices}
\end{questions}
\end{document}

But, It get nowhere.

So, What is the right way to set indentation of choice in exam documentclass?

share|improve this question

2 Answers 2

Following Section 4.10 of the exam documentation, I believe you are looking for choiceshook, which can be used as follows, for example

\renewcommand{\questionshook}{%
    \setlength{\leftmargin}{30pt}%
}
\renewcommand{\choiceshook}{%
    \setlength{\leftmargin}{50pt}%
}

Here is a complete MWE- I loaded the geometry package with showframe=true just for demonstration.

% arara: pdflatex
% !arara: indent: {overwrite: true}
\documentclass{exam}
\usepackage[showframe=true]{geometry}

\renewcommand{\questionshook}{%
    \setlength{\leftmargin}{30pt}%
}
\renewcommand{\choiceshook}{%
    \setlength{\leftmargin}{50pt}%
}
\begin{document}
\begin{questions}
    \question
    How old are you?
    \begin{choices}
        \choice 14
        \choice 17
        \choice 19
        \choice 20
        \choice 23
    \end{choices}
\end{questions}
\end{document}

For reference, here's a quote from the exam documentation

The exam document class defines these as follows:

\newcommand{\questionshook}{} 
\newcommand{\partshook}{}
\newcommand{\subpartshook}{} 
\newcommand{\subsubpartshook}{}
\newcommand{\choiceshook}{} 
\newcommand{\checkboxeshook}{} 

Thus, the default is that these commands have no effect, but you can change any of them with a \renewcommand command.

share|improve this answer
    
changing \setlength{\leftmargin}{50pt}% to \settowidth{\leftmargin}{W.\hskip\labelsep\hskip 0em} gives the desired result of indenting that I want. Though I'm pretty confused with the second argument of the \settowidth above. –  Mas Adit Apr 13 '13 at 14:52

Try this and see

\uplevel{
\begin{choices}
    \choice 
    \choice 
    \choice 
    \choice 
\end{choices}}
share|improve this answer
    
Welcome to TeX.SX! To add syntax highlighting in a post, you can select the code and click the button marked {} above the text field. –  Torbjørn T. Aug 8 at 6:40
    
Please add a document around your solution and provide a screen shot, in order to make this a real answer –  Christian Hupfer Aug 8 at 7:01
    
@ChristianHupfer I'm not sure a screenshot is always required, but I agree that some explanation should be given. –  Joseph Wright Aug 8 at 7:34
    
@JosephWright: If I would be the OP (although the question is 'old') I would prefer a screen shot as a quick check if this provided solution fulfills the request. That's why I asked about the screen shot. –  Christian Hupfer Aug 8 at 15:08
    
@ChristianHupfer 'Prefer' certainly: I was trying to say that one is not 'required' for an answer to be valid –  Joseph Wright Aug 8 at 15:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.