4

I am typesetting a competition examination paper, and I wanted to satisfy a very specific requirement for the multiple-choice questions: five choices, each with capital letter choice labels all in equal-sized circles with the labels smack in the centres of the circles, and all aligned to the question text hanging indent. It took me a while, but I have thus far combined the (excellent, detailed and clean) solutions in the following threads:

  1. Good way to make \textcircled numbers?
  2. Using circled numbers for answer choices in exam document class
  3. How can I draw circled integers with the same size by TikZ?
  4. Set indentation of choice in exam documentclass

And thus I have the following MWE:

\documentclass[preview, class=exam,varwidth=true]{standalone}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tikz}

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{%
    \node[shape=circle, draw, minimum size=1.5em, inner sep=0pt, label={center:#1}, thick] (char) {#1};}}
\renewcommand\choicelabel{%
    \circled{\thechoice}}
\renewcommand{\questionshook}{%
    \settowidth{\leftmargin}{0pt}}
\renewcommand{\choiceshook}{%
    \settowidth{\leftmargin}{W.\hskip\labelsep\hskip 0em}}

\begin{document}

\begin{questions}

\begin{EnvUplevel}
Welcome to the competition.
\end{EnvUplevel}

\question This is an example of a question. 
\begin{choices}
    \choice This is Choice A.
    \choice This is Choice B.
    \choice This is Choice C.
    \choice This is Choice D. 
    \choice This is Choice E. 
\end{choices}
\end{questions}
\end{document}

MWE

The thing is, the circles now appear to exceed the hanging indent of the question text and are a bit too far to the left, as shown by the black line I've added in mspaint. I would like the left edges of the circles to coincide precisely with the hanging indent of the question text; how may I go about doing this?

  • 1
    Unrelated: label={center:#1} isn't needed, because you have #1 in the node contents as well, so you end up printing the label twice, in the same place. – Torbjørn T. Jan 19 at 14:47
  • 3
    Probably not a good fix, but you could change 0em to 3pt (or thereabouts). – Torbjørn T. Jan 19 at 14:53
6

Here is a proposal. I only changed

 \renewcommand{\choiceshook}{\settowidth{\leftmargin}{\circled{W}.\hskip\labelsep\hskip 0em}}

to change the indent. Big thanks to Torbjørn T. for pointing out that I misread a requirement before.

\documentclass[preview, class=exam,varwidth=true]{standalone}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tikz}

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{%
    \node[shape=circle, draw, minimum size=1.5em, inner sep=0pt , thick] (char) {#1};}}
\renewcommand\choicelabel{\circled{\Alph{choice}}}
\renewcommand{\questionshook}{%
    \settowidth{\leftmargin}{0pt}}
\renewcommand{\choiceshook}{\settowidth{\leftmargin}{\circled{W}.\hskip\labelsep\hskip 0em}}

\begin{document}

\begin{questions}

\begin{EnvUplevel}
Welcome to the competition.
\end{EnvUplevel}

\question This is an example of a question. 
\begin{choices}
    \choice This is Choice A.
    \choice This is Choice B.
    \choice This is Choice C.
    \choice This is Choice D. 
    \choice This is Choice E. 
\end{choices}
\end{questions}
\end{document}

enter image description here

  • 1
    Thanks for the answer! However, I used @Torbjørn T.'s solution (the correct indent was actually 6pt) to achieve perfect alignment with the choices that the oneparchoices environment creates. – SRSR333 Jan 20 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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