1

I'm using the exam document class, and I have observed unusual behaviour of column breaks in the enumerate environment when using a forloop to specify the number of items.

When I use the forloop to generate my enumerated list of response rows, I get the following: enter image description here

However, when I generate the enumerated list manually, I get the following: enter image description here

Here is my MWE that produced both outcomes:

\documentclass[11pt,addpoints]{exam}

\usepackage[paperwidth=8.5in, paperheight=11in, hmargin={20mm,20mm}, vmargin={20mm,12mm}, includefoot, footskip=10mm]{geometry}
\usepackage{amsmath,amssymb} %math basics
\usepackage{titlesec} %for formatting section titles
\usepackage{multicol,tikz,cancel} %document basics
\usepackage{forloop} %for specifying number of questions on answer page

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
        \node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\newcommand{\tikzcircle}[2][black,fill=black]{\tikz[baseline=-0.75ex]\draw[#1,radius=#2] (0,0) circle ;}

\titleformat{\section}[runin]{\normalfont\large\bfseries}{\hskip -24pt $\Box$ \hskip 6pt Part \thesection\ -- }{0pt}{}[\normalsize \qquad {[}Total Marks: \pointsinrange{\thesection}{]} \vspace{8pt} \\ \vspace{6pt}]

\renewcommand\thesection{\Alph{section}}

\pointsinrightmargin\bracketedpoints

\pagestyle{headandfoot}

\coverfirstpageheader{Semester \\ School Board \\ School \\ Location}{}{Teacher: Mr.\ Gartenburg \\ Number of Pages: \numpages \\ Total Marks: \pointsinrange{Total} \\ Duration: 2.0 hours}
\coverrunningheader{\footnotesize\textsc{MCV4U1-02: Calculus \& Vectors}}{\textsc{Formulae}}{\footnotesize\textsc{Final Examination -- Month 2016}}
\coverrunningheadrule
\coverextraheadheight[0.75in]{0in}

\headrule
\header{\footnotesize\textsc{MCV4U1-02: Calculus \& Vectors}}{}{\footnotesize\textsc{Final Examination}, Part 1 of 2 -- \textsc{Month 2016}}
\footer{}{\thepage\ of \numpages}{}

\setlength\parindent{0pt}

\begin{document}
\begin{coverpages} \null \vspace{1.25in}
\begin{center}
\textsc{\Large MCV4U1--01} \\ \vspace{2mm}
\textsc{\large Grade 12 University Calculus \& Vectors} \\ \vspace{8mm}
{\bfseries{\scshape{\Large Final Examination}}} \\ \vspace{3mm}
\textbf{-- \ Part 1 of 2 \ --} \\ \vspace{6mm}
\textsc{{\large \today}} \\ \vspace{1in}
\textsc{\large Name: \ \ \underline{\hspace{3.5in}}}
\end{center} \vspace{0.5in}

\underline{Instructions}:
\begin{itemize}
    \item Calculators or other electronic devices are permitted provided they do \textbf{not} have wireless connectivity, are \textbf{not} capable of any symbolic or graphical computations and/or representations, do \textbf{not} store or play any media or other document files, and are used in a way that is \textbf{not} distracting to others.
    \item Any formulae, equations, etc.\ that are provided are \emph{on the reverse of this page}.
    \item Clearly demonstrate your knowledge and understanding by
    \begin{itemize}
        \item reading all questions \textbf{carefully},
        \item answering all questions \textbf{fully}, and
        \item providing concluding statements with correct \textbf{units}, where appropriate.
    \end{itemize}
    \item Round all answers to one decimal place, unless otherwise specified.
    \item Answers to all \textbf{True/False} and \textbf{Multiple Choice} questions must be provided on the \emph{Multiple Choice Answer Sheet}, which may be removed and submitted separately for convenience.
    \item Solutions to all \textbf{Full Answer} questions must be provided on the exam paper in the space provided.  (You may use the blank side of each page for rough work, but this will \textbf{not} be marked.)
\end{itemize}
\newpage \null \vspace{1in}
$$\text{some formulae}$$
\end{coverpages}
\begin{questions}
\section{True/False}
\uplevel{\hspace{-18pt} Indicate if each statement is \textbf{True} or \textbf{False}.  Record your answers on the \emph{Multiple Choice Answer Sheet}.}
\begingradingrange{Total}
\begingradingrange{A}
    \question[1] a  \label{firstA}
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a \label{lastA}
\endgradingrange{A} \newpage
\section{Multiple Choice}
\uplevel{\hspace{-18pt} Indicate the \textbf{most appropriate} response.  Record your answers on the \emph{Multiple Choice Answer Sheet}.}
\begingradingrange{B}
    \question[1] a \label{firstB}
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a \label{lastB}
\endgradingrange{B} \newpage
\section{Full Answer} 
\uplevel{\hspace{-18pt} Provide \textbf{full solutions} in the space provided.}
\begingradingrange{C}
    \question[4] a \label{firstC}
    \question[4] a
    \question[8] a
    \question[3] a
    \question[5] a
    \question[3] a
    \question[8] a
    \question[3] a
    \question[4] a
    \question[3] a
    \question[7] a
\endgradingrange{C}
\endgradingrange{Total}
\end{questions}

\newpage

\null \vspace{0.125in}

\begin{centering}
{\LARGE Multiple Choice Answer Sheet} \vspace{0.625in} \\
\textsc{\large Name: \ \ \underline{\hspace{3.5in}}} \vspace{0.625in} \\
\end{centering} \label{answersheet}

\textsc{\large Instructions:} \vspace{2mm}

\quad Use a \textbf{solid dot} to ``block out'' your response to each question. \vspace{3mm}

\begin{tabular}{ll}
Correct: \hspace{4mm} T \hspace{10mm} \tikzcircle{7pt} & Incorrect: \hspace{4mm} T \hspace{10mm} \circled{F} \vspace{5mm} \\
Correct: \hspace{4mm} \tikzcircle{7pt} \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D \hspace{0.375in} & Incorrect:  \hspace{4mm} \xcancel{A} \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
\end{tabular}\vspace{0.5in}

\textbf{Part A -- True/False} \newcounter{j}

\begin{enumerate}
\begin{multicols}{4} \raggedcolumns
\forloop{j}{\ref{firstA}}{\value{j}<\ref{lastA}}{\item \hspace{4mm} T \hspace{10mm} F}
\item \hspace{4mm} T \hspace{10mm} F
\end{multicols}
\end{enumerate} \vspace{0.25in}

\textbf{Part B -- Multiple Choice}

\begin{enumerate}
\begin{multicols}{2} \setcounter{enumi}{\ref{lastA}} \raggedcolumns
\forloop{j}{\ref{firstB}}{\value{j}<\ref{lastB}}{\item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D}
\item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
\end{multicols}
\end{enumerate} \newpage \null \vspace{0.125in}

\begin{centering}
{\LARGE Multiple Choice Answer Sheet} \vspace{0.625in} \\
\textsc{\large Name: \ \ \underline{\hspace{3.5in}}} \vspace{0.625in} \\
\end{centering} \label{answersheet}

\textsc{\large Instructions:} \vspace{2mm}

\quad Use a \textbf{solid dot} to ``block out'' your response to each question. \vspace{3mm}

\begin{tabular}{ll}
Correct: \hspace{4mm} T \hspace{10mm} \tikzcircle{7pt} & Incorrect: \hspace{4mm} T \hspace{10mm} \circled{F} \vspace{5mm} \\
Correct: \hspace{4mm} \tikzcircle{7pt} \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D \hspace{0.375in} & Incorrect:  \hspace{4mm} \xcancel{A} \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
\end{tabular} \vspace{0.5in}

\textbf{Part A -- True/False}
\begin{enumerate}
\begin{multicols}{4} \raggedcolumns
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
\end{multicols}
\end{enumerate} \vspace{0.25in}

\textbf{Part B -- Multiple Choice}
\begin{enumerate}\setcounter{enumi}{25}
\begin{multicols}{2}
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
\end{multicols}
\end{enumerate}

\end{document}

Any suggestions or fixes would be greatly appreciated.

  • Welcome to TeX.SX! Can you reduce this document to the absolute minimum that shows the issue? And don't use $$....$$ -- that's deprecated. Use \[...\] instead, please! (And it's useless anyway: $$\text{...}$$??? You could just use the text instead of switching to math mode – user31729 Feb 3 '16 at 23:13
  • Additionally, I think the enumerate environments should be inside multicols not vice versa – user31729 Feb 3 '16 at 23:19
2

The 'MWE' is quite hard to read,but the main issues are

  • \begin{enumerate}\begin{multicols}{4} looks wrong → use it the other way round
  • The \forloop is initialized with \ref{firstA}, which isn't expandable or provides something not being a real (integer) number. This loop is screwed up. In order to get the reference counter value, use \getrefnumber{firstA}, loading the package refcount of course for this Using \ref{firstA} this will confuse the \forloop command, leaving rubbish in the enumerate list and confusing multicols as well.
  • The start value of enumerate should be done with the enumitem package and its start= option to enumerate instead of \setcounter{enumi}{...} (I've not done this here!)

\documentclass[11pt,addpoints]{exam}

\usepackage[paperwidth=8.5in, paperheight=11in, hmargin={20mm,20mm}, vmargin={20mm,12mm}, includefoot, footskip=10mm]{geometry}
\usepackage{amsmath,amssymb} %math basics
\usepackage{titlesec} %for formatting section titles
\usepackage{multicol,tikz,cancel} %document basics
\usepackage{refcount}%
\usepackage{forloop} %for specifying number of questions on answer page

\newcounter{j}

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
        \node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\newcommand{\tikzcircle}[2][black,fill=black]{\tikz[baseline=-0.75ex]\draw[#1,radius=#2] (0,0) circle ;}

\titleformat{\section}[runin]{\normalfont\large\bfseries}{\hskip -24pt $\Box$ \hskip 6pt Part \thesection\ -- }{0pt}{}[\normalsize \qquad {[}Total Marks: \pointsinrange{\thesection}{]} \vspace{8pt} \\ \vspace{6pt}]

\renewcommand\thesection{\Alph{section}}

\pointsinrightmargin\bracketedpoints

\pagestyle{headandfoot}

\coverfirstpageheader{Semester \\ School Board \\ School \\ Location}{}{Teacher: Mr.\ Gartenburg \\ Number of Pages: \numpages \\ Total Marks: \pointsinrange{Total} \\ Duration: 2.0 hours}
\coverrunningheader{\footnotesize\textsc{MCV4U1-02: Calculus \& Vectors}}{\textsc{Formulae}}{\footnotesize\textsc{Final Examination -- Month 2016}}
\coverrunningheadrule
\coverextraheadheight[0.75in]{0in}

\headrule
\header{\footnotesize\textsc{MCV4U1-02: Calculus \& Vectors}}{}{\footnotesize\textsc{Final Examination}, Part 1 of 2 -- \textsc{Month 2016}}
\footer{}{\thepage\ of \numpages}{}

\setlength\parindent{0pt}

\begin{document}
\begin{coverpages} \null \vspace{1.25in}
\begin{center}
\textsc{\Large MCV4U1--01} \\ \vspace{2mm}
\textsc{\large Grade 12 University Calculus \& Vectors} \\ \vspace{8mm}
{\bfseries{\scshape{\Large Final Examination}}} \\ \vspace{3mm}
\textbf{-- \ Part 1 of 2 \ --} \\ \vspace{6mm}
\textsc{{\large \today}} \\ \vspace{1in}
\textsc{\large Name: \ \ \underline{\hspace{3.5in}}}
\end{center} \vspace{0.5in}

\underline{Instructions}:
\begin{itemize}
    \item Calculators or other electronic devices are permitted provided they do \textbf{not} have wireless connectivity, are \textbf{not} capable of any symbolic or graphical computations and/or representations, do \textbf{not} store or play any media or other document files, and are used in a way that is \textbf{not} distracting to others.
    \item Any formulae, equations, etc.\ that are provided are \emph{on the reverse of this page}.
    \item Clearly demonstrate your knowledge and understanding by
    \begin{itemize}
        \item reading all questions \textbf{carefully},
        \item answering all questions \textbf{fully}, and
        \item providing concluding statements with correct \textbf{units}, where appropriate.
    \end{itemize}
    \item Round all answers to one decimal place, unless otherwise specified.
    \item Answers to all \textbf{True/False} and \textbf{Multiple Choice} questions must be provided on the \emph{Multiple Choice Answer Sheet}, which may be removed and submitted separately for convenience.
    \item Solutions to all \textbf{Full Answer} questions must be provided on the exam paper in the space provided.  (You may use the blank side of each page for rough work, but this will \textbf{not} be marked.)
\end{itemize}
\newpage \null \vspace{1in}
 %    $$\text{some formulae}$$
\end{coverpages}
\begin{questions}
\section{True/False}
\uplevel{\hspace{-18pt} Indicate if each statement is \textbf{True} or \textbf{False}.  Record your answers on the \emph{Multiple Choice Answer Sheet}.}
\begingradingrange{Total}
\begingradingrange{A}
    \question[1] a  \label{firstA}
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a \label{lastA}
\endgradingrange{A} \newpage
\section{Multiple Choice}
\uplevel{\hspace{-18pt} Indicate the \textbf{most appropriate} response.  Record your answers on the \emph{Multiple Choice Answer Sheet}.}
\begingradingrange{B}
    \question[1] a \label{firstB}
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a
    \question[1] a \label{lastB}
\endgradingrange{B} \newpage
\section{Full Answer} 
\uplevel{\hspace{-18pt} Provide \textbf{full solutions} in the space provided.}
\begingradingrange{C}
    \question[4] a \label{firstC}
    \question[4] a
    \question[8] a
    \question[3] a
    \question[5] a
    \question[3] a
    \question[8] a
    \question[3] a
    \question[4] a
    \question[3] a
    \question[7] a
\endgradingrange{C}
\endgradingrange{Total}
\end{questions}

\newpage

\null \vspace{0.125in}

\begin{centering}
{\LARGE Multiple Choice Answer Sheet} \vspace{0.625in} \\
\textsc{\large Name: \ \ \underline{\hspace{3.5in}}} \vspace{0.625in} \\
\end{centering} \label{answersheet}

\textsc{\large Instructions:} \vspace{2mm}

\quad Use a \textbf{solid dot} to ``block out'' your response to each question. \vspace{3mm}

\begin{tabular}{ll}
Correct: \hspace{4mm} T \hspace{10mm} \tikzcircle{7pt} & Incorrect: \hspace{4mm} T \hspace{10mm} \circled{F} \vspace{5mm} \\
Correct: \hspace{4mm} \tikzcircle{7pt} \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D \hspace{0.375in} & Incorrect:  \hspace{4mm} \xcancel{A} \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
\end{tabular}\vspace{0.5in}

\textbf{Part A -- True/False} 

\begin{multicols}{4} \raggedcolumns
\begin{enumerate}
  \forloop{j}{\getrefnumber{firstA}}{\value{j}<\getrefnumber{lastA}}{\item \hspace{4mm} T \hspace{10mm} F}
\item \hspace{4mm} T \hspace{10mm} F
\end{enumerate} 
\vspace{0.25in}
\end{multicols}

\textbf{Part B -- Multiple Choice}

\begin{multicols}{2} \setcounter{enumi}{\ref{lastA}} \raggedcolumns
\begin{enumerate}
\forloop{j}{\ref{firstB}}{\value{j}<\ref{lastB}}{\item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D}
\item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
\end{enumerate} \newpage \null \vspace{0.125in}
\end{multicols}

\begin{centering}
{\LARGE Multiple Choice Answer Sheet} \vspace{0.625in} \\
\textsc{\large Name: \ \ \underline{\hspace{3.5in}}} \vspace{0.625in} \\
\end{centering} \label{answersheet}

\textsc{\large Instructions:} \vspace{2mm}

\quad Use a \textbf{solid dot} to ``block out'' your response to each question. \vspace{3mm}

\begin{tabular}{ll}
Correct: \hspace{4mm} T \hspace{10mm} \tikzcircle{7pt} & Incorrect: \hspace{4mm} T \hspace{10mm} \circled{F} \vspace{5mm} \\
Correct: \hspace{4mm} \tikzcircle{7pt} \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D \hspace{0.375in} & Incorrect:  \hspace{4mm} \xcancel{A} \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
\end{tabular} \vspace{0.5in}

\textbf{Part A -- True/False}
\begin{multicols}{4} \raggedcolumns
\begin{enumerate}
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
    \item \hspace{4mm} T \hspace{10mm} F
\end{enumerate} \vspace{0.25in}
\end{multicols}

\textbf{Part B -- Multiple Choice}
\begin{multicols}{2}
\begin{enumerate}\setcounter{enumi}{25}
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
    \item \hspace{4mm} A \hspace{10mm} B \hspace{10mm} C \hspace{10mm} D
\end{enumerate}
\end{multicols}

\end{document}
  • No complaints about the various \hspace etc. here, please. – user31729 Feb 3 '16 at 23:27
  • Since the document itself is very 'strange' (in my point of view), I can't provide more help on the restructuring right now. This would take some time – user31729 Feb 3 '16 at 23:35

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.