[Tex/LaTex] Using \extrawidth in exam class results in unwanted margin changes (per page)

exammargins

I'm trying out the Exam class after seeing good things about it on this site following the guide: Using the exam document class by Philip Hirschhorn . However, I've run into some problems with the number of marks in the margin. I have tried using the \extrawidth{} function but to no avail.

When all my qs fit on one page it works, but when the questions run over one page the margins keep on changing by their self…

MWE:

% Exam style
    \documentclass[addpoints,12pt]{exam}
% Adding in my packages for maths
    \usepackage[utf8]{inputenc}
    \usepackage{amsmath, amsfonts, amssymb, color, mathtools}
% Borders
    \usepackage[a4paper,bindingoffset=0 cm, left=2cm, right=2cm, top=2cm, bottom=2cm, footskip=0.5cm]{geometry}
%--------------------------------------------------------------------
%   Customisations to the exam layout design
%--------------------------------------------------------------------
% Settings for marks
    \pointsdroppedatright  % Marks at bottom right
    \marginpointname{ \points}  % Gives my margin points a name
    \marksnotpoints  % Using 'Marks' not 'Points'
    \pointformat{\themarginpoints}  % Setting for the display
% Settings for total marks (per question)
    \totalformat{Total Marks for Question \thequestion: \totalpoints  \points}  % Setting for the display  
% Settings for questions
    \qformat{\textbf{Question \thequestion} (\totalpoints\ \points) \hfill}
    \renewcommand{\questionshook}{%
          \setlength{\leftmargin}{0cm}%
          \setlength{\labelwidth}{-\labelsep}%
    }  % No indent for the question content

\begin{document}
\begin{questions}
% So the dropmarks fit in the right margin
    \extrawidth{3cm}
    \question  %[2] means worth 2 marks, not question 2
    Imagine if there is no air
    \begin{parts}    
        \part[2] What would be the effect on the balloon industry? 
        \fillwithlines{5cm}
        \droppoints
        \part[6] What would be the effect on the aircraft industry? 
        \fillwithlines{15cm}
        \droppoints
    \end{parts}
    \question[5]
    Why is there air?
    \fillwithlines{15cm}
    \droppoints
\end{questions}
\end{document}

When I run it, the margins are different one page one and two and the guide I'm using has no answer… (tried google too with no avail)

Any help appreciated thanks!

Best Answer

Place the \extrawidth command before \begin{document}. Otherwise, \extrawidth applies only to the current page (I believe).

\documentclass{exam}
\usepackage[a4paper,bindingoffset=0 cm, left=2cm, right=2cm, top=2cm, bottom=2cm, footskip=0.5cm]{geometry}
\totalformat{Total Marks for Question \thequestion: \totalpoints  \points}  % Setting for the display  
% Settings for questions
\qformat{\textbf{Question \thequestion} (\totalpoints\ \points) \hfill}
\renewcommand{\questionshook}{%
      \setlength{\leftmargin}{0cm}%
      \setlength{\labelwidth}{-\labelsep}%
}  % No indent for the question content

\extrawidth{3cm}

\begin{document}
\begin{questions}
% So the dropmarks fit in the right margin
\question  %[2] means worth 2 marks, not question 2
Imagine if there is no air
\begin{parts}    
    \part[2] What would be the effect on the balloon industry? 
    \fillwithlines{5cm}
    \droppoints
    \part[6] What would be the effect on the aircraft industry? 
    \fillwithlines{15cm}
    \droppoints
\end{parts}
\question
Why is there air?
\begin{parts}
  \part[2]Why is there not no air?
  \fillwithlines{5cm}
  \droppoints
  \part[3]Why not something other than air?
  \fillwithlines{5cm}
  \droppoints
\end{parts}
\end{questions}
\end{document}
Related Question