I'm trying to align the indentation of questions with two different formats (one for extended responses, the other, multiple choice).
As much as I try, I am stuck using various random numbers to try to align it properly, and I can't figure out how to get the question for the multiple choice aligned - adjusting questionshook will often touch the second question, and seemingly \renewcommand{\questionshook}
doesn't seem to work in the middle of the document (unlike \renewcommand{\choiceshook}
etc), which means I can't seem to treat each part standalone.
This is what I have right now:
This is what I desire:
This is my code, which is unfortunately not super short because of the interactions with other questions:
\documentclass[%
12pt,
a4paper,
]{exam}
\usepackage[showframe=true]{geometry}
\usepackage{calc}
\renewcommand{\questionshook}{%
\setlength{\leftmargin}{0pt}%
\labelwidth\leftmargin\advance\labelwidth-\labelsep%
}
% Dimensions tuned to be about right.
\renewcommand{\partshook}{
\setlength{\topsep}{-0.02in}%
\setlength{\leftmargin}{\leftmargin+0.08in}%
\setlength{\labelsep}{0.22in}%
}
\newlength{\mcindent}
\setlength{\mcindent}{0.55cm}
\renewcommand{\choiceshook}{%
% The dimensions are tuned to be about right. I should figure out how to not have random numbers.
\settowidth{\leftmargin}{W\hspace{\labelsep}\hspace{0.18in}\hspace{\mcindent}}
}
\begin{document}
\begin{questions}
% multiple choice format
\noqformat
\renewcommand{\thequestion}{\textbf{\arabic{question}}}
% This makebox sort of works for the first line.
\renewcommand{\questionlabel}{\makebox[1cm][l]{\thequestion}}
\pointsinmargin\pointformat{}
% an adjustbox from https://tex.stackexchange.com/a/35934/200609 does not work properly as all there is some indentation from the number already
\question[1]%
I wish to have both lines of this sentence aligned with the A/B/C/D multiple choice options.
\begin{choices}
\choice Oh really?
\choice Here I will demonstrate how to type a long sentence, to confirm that it works here.
\end{choices}
% extended response format
\qformat{\textbf{Question \thequestion} (\totalpoints\ marks)\hfill}
\pointsinrightmargin
\pointformat{\textbf{\themarginpoints}}
\question%
This question should remain in the same format, aligned to the border. I do no know how to do this whilst doing the choice answer indented using questionshook, since redefining it does not seem to work.
\begin{parts}
\part[1] Ideally the text in these parts should be at the same indent as the multiple choice options, but it is closer enough at the moment that I can ignore it.
\part[2] This is another long sentence to make sure indentation works properly, as I tend to forgot to fix that.
\end{parts}
\end{questions}
\end{document}