5

I'm using TexLive 2015 under Windows XP, and using the latest exam class. Here is the sample code build by Xelatex engine.

\documentclass[a4paper]{exam}

\begin{document}
\begin{questions}
\question[10] questions
\begin{parts}
\part[2] part one
\part[4] part two
\part[4] part three
\end{parts}
\begin{solution}[10cm]
solution
\end{solution}

\end{questions}
\end{document}

The result screen shot see below. screen shot of the result

You see that the part (b) and (c) are not vertically aligned. Any ideas? Thanks.

EDIT: as Manuel told me that it did aligned at the ), so my question is: Is it possible to both aligned at ( and ), only aligned at ) dose not look quite nice as the screen shot shows. Because (c) looks a bit smaller than the (b) as shown in the image.

EDIT2: I mark egreg's answer as the solution, since I think align on both ( and ) is not a good idea, see comments below.

2
  • They are vertically aligned at the end, that is, after the ) in in the item label.
    – Manuel
    Commented Jan 3, 2016 at 14:57
  • @Manuel Oh, I do see that, but it looks not quite nice if the ( is not aligned. Is it possible to aligned at both ( and )?
    – ollydbg23
    Commented Jan 3, 2016 at 15:01

1 Answer 1

5

You can use (perhaps abuse) the \partshook command, that's usually empty, in order to modify the definition \parts does for \makelabel; \parts defines \makelabel to do \hss\llap{##1}, which makes for the label to be right aligned in the reserved space, so we can make it do \rlap{##1}\hss (that is, the reverse).

\documentclass[a4paper]{exam}

\renewcommand{\partshook}{%
  \renewcommand\makelabel[1]{\rlap{##1}\hss}%
}

\begin{document}
\begin{questions}
\question[10] questions
\begin{parts}
\part[2] part one
\part[4] part two
\part[4] part three
\end{parts}
\begin{solution}[10cm]
solution
\end{solution}

\end{questions}
\end{document}

enter image description here

7
  • 1
    Hi, egreg, thanks, from the screen shot of your answer, I still see (c) is a little smaller than the (b), so this is still the format I expected. Is it possible to format the label text, I mean add a fixed size box around the "a", "b" and "c", so that I can have both aligned ( and ), thanks.
    – ollydbg23
    Commented Jan 4, 2016 at 4:30
  • follow the method you mentioned, I may find the solution, I just add a line \renewcommand\partlabel{(\hbox to 10pt{\hfil \thepartno\hfil)}} inside the partshook body, and it looks fine.
    – ollydbg23
    Commented Jan 4, 2016 at 7:48
  • @ollydbg23 I wouldn't do that, but it's your document. ;-)
    – egreg
    Commented Jan 4, 2016 at 11:32
  • I just looked at the page:wiki books Latex 2 Nested lists, it looks like the aligned on the ) is the default way for the enumerate environment, so no one has complain this alignment before?
    – ollydbg23
    Commented Jan 4, 2016 at 11:39
  • @ollydbg23 Yes, that's the default for LaTeX lists.
    – egreg
    Commented Jan 4, 2016 at 11:55

You must log in to answer this question.

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