4

I am using the exam document class and have a few questions about customising the layout. Firstly I want to move the question number to the left so it is in line with the left header, and I want more horizontal space between the question number and the actual text of the question. I'd like to do the same with the question part numbers too, having it aligned with the left part of text of the question above, and left justified instead of right justified.

My explanation was a bit rubbish, so here's a pic to illustrate something like what I am after (I want the left, instead of the right):

enter image description here

MWE:

\documentclass[a4paper]{exam}
\renewcommand{\thepartno}{\roman{partno}}

\begin{document}
\firstpageheader{\large\textbf{Pure Mathematics: Number theory}}{}{\thepage}
\runningheader{}{}{\thepage}
\vspace*{0cm}

\begin{questions}

\question
For positive integers $a$, $b$ and $c$ \ldots 

\begin{parts}

\part
For positive integers $a$, $b$ and $c$ \ldots 

\part
For positive integers $\alpha$, $\beta$ and $\gamma$ \ldots 

\end{parts}

\end{questions}

\end{document}
  • 1
    \renewcommand{\questionlabel}{\thequestion.\hfill} will align the question numbers to the left. Not sure about the parts, though. – cfr Jun 27 '14 at 22:09
  • @cfr Thanks. Interesting how that doesn't seem to work for the part numbers. – Superbus Jun 27 '14 at 22:13
  • Yes. Odd, isn't it? – cfr Jun 27 '14 at 22:17
  • Eventually you might find it easier to stop using exam class than trying to force it to do what you want. – John Kormylo Jun 28 '14 at 14:58
3

In order to achieve what you want:

  1. To move the question number to the left:
    • modify the length leftmargin of the questions environment.
  2. More horizontal space between the question number and the actual text of the question.
    • modify the length labelsep of the questions environment.
  3. Parts left justified instead of right justified.
  4. Have the question part numbers aligned with the left part of text of the question above.
    • modify the lengths leftmargin and labelsep of the parts environment.

The lengths for parts 1 and 2 can be modified setting the variable questionshook, and for part 3 and 4 that command and those lengths must be set with the variable partshook (see section 4.10 "Customizing the list parameters" of the exam class manual).

So, your MWE should be the next one:

\documentclass[a4paper]{exam}
\renewcommand{\thepartno}{\roman{partno}}

%% For task 1 and 2
\renewcommand{\questionshook}{\setlength{\leftmargin}{2.5em}\setlength{\labelsep}{1.5em}}
%% For task 3 and 4
\renewcommand{\partshook}{\renewcommand\makelabel[1]{\rlap{##1}\hss}\setlength{\leftmargin}{2em}\setlength{\labelsep}{0.5em}}

\begin{document}
\firstpageheader{\large\textbf{Pure Mathematics: Number theory}}{}{\thepage}
\runningheader{}{}{\thepage}
\vspace*{0cm}

\begin{questions}

\question
For positive integers $a$, $b$ and $c$ \ldots

\begin{parts}

\part
For positive integers $a$, $b$ and $c$ \ldots

\part
For positive integers $\alpha$, $\beta$ and $\gamma$ \ldots

\end{parts}

\question
For positive integers $a$, $b$ and $c$ \ldots

\begin{parts}

\part
For positive integers $a$, $b$ and $c$ \ldots

\part
For positive integers $\alpha$, $\beta$ and $\gamma$ \ldots

\end{parts}

\end{questions}

\end{document}

And this is how it looks like:

final document

  • I am sorry for the irrelevant question, but for the question label, how can I make it left-aligned with the question body without going inside the left margin? – Diaa Sep 2 '18 at 16:07

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.