3

I'm currently writing an exam and require specific indentation on the left to match the following:

enter image description here

I have been using exam class and have now sorted out the right margin and exam marks but my left indentation is not right. As you can see below, information after the question has been indented, as has the enumerate. Any ideas on how to fix this? I'm a bit of a novice!

enter image description here

1
  • 1
    Actually, the hardest part to change is left justifying the numbers instead of right justifying them in boxes. It is built into \item itself. Commented Oct 25, 2020 at 5:41

1 Answer 1

3

It appears you want the part and subpart indentation to be equal. I arbitrarily chose \leftmargini.

\documentclass{exam}
\usepackage{showframe}% MWE only, to show first margin
\marksnotpoints

\renewcommand{\questionlabel}{Question \thequestion.}
\renewcommand{\questionshook}{\leftmargin=0pt%
  \labelwidth=-\labelsep}
  
\renewcommand\partlabel{\hbox to \labelwidth{\alph{partno}.\hfil}}
\renewcommand{\partshook}{\setlength{\leftmargin}{\leftmargini}%
  \setlength{\labelwidth}{\dimexpr \leftmargin-\labelsep}}
  
\renewcommand\subpartlabel{\hbox to \labelwidth{\thesubpart.\hfil}}
\renewcommand{\subpartshook}{\setlength{\leftmargin}{\leftmargini}%
  \setlength{\labelwidth}{\dimexpr \leftmargin-\labelsep}}


\begin{document}
\begin{questions}
\question[4]\hfill

This is the first question.
\begin{parts}
\part
This is a part.
\part
\begin{subparts}
\subpart
This is a subpart.
\subpart
This is a periscope.
\subpart
This is a pair of diving planes.
\end{subparts}
\part
It's sad to be apart.
\end{parts}
\end{questions}
\end{document}

demo

4
  • Thank you very much! That works perfectly. Commented Oct 26, 2020 at 0:22
  • Is there a way i can use \begin{itemize} \item...... (1 mark) \item ...... (1 mark) \item ........ (1 mark) \end{itemize} in exam document class Commented Aug 26, 2023 at 18:42
  • @ElijahOjiambo - Not sure what you want to do with "(1 mark)". If you intend to use exam class points, you should use questions etc. environments. They are based on itemize, but with lots of additions. Note that \question calls \item internally. Commented Aug 26, 2023 at 21:10
  • 1 mark is points dropped on the right margin Commented Aug 27, 2023 at 4:22

You must log in to answer this question.

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