2

I've been experimenting with the exam class as an alternative to word and am attempting to get the formatting as similar as possible to the Year 12 format by country uses. Below is an example of such:

Questions with no parts:

enter image description here

Questions with parts:

enter image description here

Multiple Choice:

enter image description here

\documentclass[a4paper,12pt,addpoints]{exam}

\usepackage{newtxtext,newtxmath} %Font%
\usepackage{xcolor} %Color package%
\usepackage[onehalfspacing]{setspace}
\usepackage{graphicx}
\graphicspath{{./images/}} %Directory for images: Samefolder/images%
\usepackage{geometry}
\usepackage{tikz}
\usepackage{setspace}
\singlespacing

%Choose page margins%
\geometry{
    a4paper,
    total={168.494mm,275mm},
    left=13mm,
    top=10mm,
}

\setlength\linefillheight{1cm} %Space between answer lines%
\pointsinrightmargin %Marks aligned to the right margin, left juxtaposed%
\pointsdroppedatright
\pointformat{\thepoints} %Format of marks%
\marksnotpoints %Display marks instead of points%
\setlength{\rightpointsmargin}{0.5cm} %Indent marks%

\renewcommand{\thepartno}{\textbf{\alph{partno}}} %Formatting parts%
\renewcommand{\partlabel}{\thepartno.} 
\renewcommand{\partshook}{\setlength\leftmargin{0pt} \setlength\itemsep{1cm}}
\renewcommand{\questionshook}{\setlength{\itemsep}{1.5cm}} %Formatting questions%

\qformat{ \textbf{Question \thequestion} (\totalpoints\ marks) \hfill} %Question title format%

\pagestyle{headandfoot}  %header%
\extraheadheight[0.7cm]{0.7cm}
\firstpageheader{\scriptsize{YEAR CLASS EXAMINATION XX}}{\scriptsize{\thepage}}{}
\runningheader{\scriptsize{YEAR CLASS EXAMINATION XX}}{\scriptsize{\thepage}}{}\firstpagefooter{}{}{}
\runningfooter{}{}{}
\renewcommand{\questionshook}{\setlength{\itemsep}{1.2cm}} %Formatting questions%
\renewcommand\choicelabel{\bfseries{\Alph{choice}.}} 
\renewcommand{\choiceshook}{%
    \setlength{\leftmargin}{1mm}% 
    \setlength{\labelwidth}{\labelsep}%
    \setlength{\itemsep}{0.25mm}
}

\begin{document}

\begin{questions} 

%%%%%%%%%%%% Page 1 %%%%%%%%%%%%
\question %Question 1%
    \begin{parts}
        \part[2] Let $y=3x^2(\log_e(x^3))$. Find the derivative of $y$.
        \droppoints
        \fillwithlines{7cm}
        \part[2] Let $f(x)=\sin^2(x)$. Find $f'\left(\pi\right)$. 
        \droppoints
        \fillwithlines{7cm}
    \end{parts}
\pagebreak

%%%%%%%%%%%% Page 2 %%%%%%%%%%%%
\question %Question 2%
\parbox[4mm][]{\linewidth}{}\par %Correct Spcing if the intial question text goes over multiple lines%
\hspace*{-5.8mm}{\parbox{475pt}
    {This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines \\
    This is then on the next line.      
    }}\vspace*{4mm} %Correct alignment%
        \begin{parts}
            \part[1] State the asymptotes. 
            \droppoints
            \fillwithlines{4cm}
            \part[3] Sketch the function on the set of axes below. Label all intercepts, and all asymptotes with their equation.
            \droppoints
            \begin{center}
                \includegraphics[scale=1.3]{q2_b_axes}
            \end{center}
        \end{parts} 
    
    \question[1]  
    \hspace*{-5.8mm}{\parbox{475pt}{Text}}
    \begin{choices}
        \choice One
        \correctchoice Two
        \choice Three
        \choice Four
        \choice Five
    \end{choices}
    
    \question[1]  
    \par %Correct Spcing if the intial question text goes over multiple lines%
    \hspace*{-5.8mm}{\parbox[t]{475pt}{This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines}}\vspace*{2mm} %Correct alignment%
    \begin{choices}
        \choice One
        \correctchoice Two
        \choice Three 
        \choice Four
        \choice Five
    \end{choices}
    
        
\end{questions}
    
\end{document}

Which produces: enter image description here enter image description here enter image description here

It looks decent at first glance but when using qformat, the initial question text is indented. I used some sort of box and negative spacing to fit it but it doesn't perfectly align. Another problem is directly after the qformat, when the question text exceeds one line, the text between "Question X" and the first line of the question shrinks.

As I plan on producing documents on a large scale, I was wondering if there was a more elegant fix to replicate the Year 12 Exam style. If this isn't possible in the exam class, is it possible to simply not use the exam commands and create newcommands that can replicate the format I want.

Thanks in advanced.

1 Answer 1

1

Try this code with some changes of \qformat and the hooks to make everything left aligned.

e4

The horizontal label separation can be adjusted using \setlength{\iseparation}{<space>} (used 1ex in the example).

Inside the question text you can use \newline to start a new line or \par to start a new paragraph.

\documentclass[a4paper,12pt,addpoints]{exam}

\usepackage{newtxtext,newtxmath} %Font%
\usepackage{xcolor} %Color package%
\usepackage[onehalfspacing]{setspace}
\usepackage{graphicx}
\graphicspath{{./images/}} %Directory for images: Samefolder/images%
\usepackage{geometry}
\usepackage{tikz}
\usepackage{setspace}
\singlespacing

%Choose page margins%
\geometry{
    a4paper,
    total={168.494mm,275mm},
    left=13mm,
    top=10mm,
}

\setlength\linefillheight{1cm} %Space between answer lines%
\pointsinrightmargin %Marks aligned to the right margin, left juxtaposed%
\pointsdroppedatright
\pointformat{\thepoints} %Format of marks%
\marksnotpoints %Display marks instead of points%
\setlength{\rightpointsmargin}{0.5cm} %Indent marks%
    
\pagestyle{headandfoot}  %header%
\extraheadheight[0.7cm]{0.7cm}
\firstpageheader{\scriptsize{YEAR CLASS EXAMINATION XX}}{\scriptsize{\thepage}}{}
\runningheader{\scriptsize{YEAR CLASS EXAMINATION XX}}{\scriptsize{\thepage}}{}\firstpagefooter{}{}{}
\runningfooter{}{}{}
    
%%****************************************************** <<<<<<<<<<<<<<<<<<<<<
\qformat{%%Question title format  changed <<<<<<<<<<<
    \parbox{\linewidth}{\textbf{Question~\thequestiontitle}\ (\totalpoints\ marks) \\[-1.5ex]}% changed <<<<<<<<<
}

\renewcommand{\questionshook}{%%Formatting questions changed <<<<<<<<<
    \setlength{\leftmargin}{0pt}%
    \setlength{\labelwidth}{-\labelsep}%
}
\newlength{\iseparation}
\setlength{\iseparation}{1ex}% use to change the label separation

\renewcommand\choicelabel{\bfseries{\Alph{choice}.}} 
    \renewcommand{\choiceshook}{% added <<<<<<<<<<<<
    \setlength{\leftmargin}{0pt}
    \setlength{\labelwidth}{-\labelsep}%
    \def\makelabel##1{##1\hskip1\iseparation}%   
}

\renewcommand{\thepartno}{\textbf{\alph{partno}}} %Formatting parts%
\renewcommand{\partlabel}{\thepartno.} 

\renewcommand{\partshook}{% added <<<<<<<<<<<<
    \settowidth{\leftmargin}{W.\hskip\labelsep}%
    \setlength{\labelwidth}{-\labelsep}%
    \def\makelabel##1{\hskip-\leftmargin##1\hskip\iseparation}%   
}
%%******************************************************

\begin{document}
    \begin{questions} 
        
        %%%%%%%%%%%% Page 1 %%%%%%%%%%%%
        \question %Question 1%
        \begin{parts}
            \part[2] Let $y=3x^2(\log_e(x^3))$. Find the derivative of $y$.
            \droppoints
            \fillwithlines{7cm}
            \part[2] Let $f(x)=\sin^2(x)$. Find $f'\left(\pi\right)$. 
            \droppoints
            \fillwithlines{7cm}
        \end{parts}
    
    \question[3]%Question 2
     Compute $\displaystyle\int_0^1 x^2 \, dx$.
        \fillwithlines{\fill}
        \pagebreak
        
        %%%%%%%%%%%% Page 2 %%%%%%%%%%%%
        \question %Question 3% Use \par instead of \\ to start a new paragraph <<<<<<<<<<<<<<<<<<<
        This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines. \newline This is then on the next line.      \par This starts a new paragraph.
        \begin{parts}
            \part[1] State the asymptotes. 
            \droppoints
            \fillwithlines{4cm}
            \part[3] Sketch the function on the set of axes below. Label all intercepts, and all asymptotes with their equation.
            \droppoints
            \begin{center}
                \includegraphics[scale=0.5]{example-image}
            \end{center}
        \end{parts} 
        
        \question[1]   %Question 4%
        Text
        \begin{choices}
            \choice One
            \correctchoice Two
            \choice Three
            \choice Four
            \choice Five
        \end{choices}
        
        \question[1]  %Question 5%
        This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines This Text Goes Over Multiple Lines %Correct alignment%
        \begin{choices}
            \choice One
            \correctchoice Two
            \choice Three 
            \choice Four
            \choice Five
        \end{choices}       
        
    \end{questions}
    
\end{document}

You must log in to answer this question.

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