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
add comment

1 Answer 1

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
add comment

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.