Make every realization have same number of pages

Added by shreikant kv over 9 years ago

Suppose you want every copy/student's test have exactly 16 pages, no matter how the questions/options are randomized.

Follow the steps:

1. Put \AMCqlabel{paperends} % where your question paper ends in the latex file

2. Assume you want to make your question paper booklet of 16 pages: Then put the following after where you have put "paperends" in item 1. (above) this requires package "ifthen"

\ifthenelse{\equal{\AMCpageref{paperends}}{11}}{\forntimes{5}{\blankbookpage}}{}\ifthenelse{\equal{\AMCpageref{paperends}}{12}}{\forntimes{4}{\blankbookpage}}{} \ifthenelse{\equal{\AMCpageref{paperends}}{13}}{\forntimes{3}{\blankbookpage}}{}\ifthenelse{\equal{\AMCpageref{paperends}}{14}}{\forntimes{2}{\blankbookpage}}{}\ifthenelse{\equal{\AMCpageref{paperends}}{15}}{\forntimes{1}{\blankbookpage}

This will ensure that all realizations of the test will have 16 pages.

3. Define the macro: "forntimes" using "pfgfor" package and given as:

\newcommand{\forntimes}[2]{
\foreach \n in {1,...,#1}{#2}}

4. Define the macro: "blankbookpage" given as:

\newcommand{\blankbookpage}{\newpage \tiny \underline{\textsc{Space For Rough Work}}


Replies (3)

RE: Make every realization have same number of pages - Added by shreikant kv over 9 years ago

It would be conveninet for end users if the above is included as a macro in AMC like:
\AMCSamesize{16}.

RE: Make every realization have same number of pages - Added by Dominik Vogel about 8 years ago

I tried this solution and find three errors in the code. Therefore, I'd like to share my solution in order to help others to have every realization with the same number of pages.

The errors are:
1. The last ifthenelse-element lacks a "}{}"
2. The second package needed is called "pgffor"
3. There is a missing "}" at the end of the definition of \blankbookpage

Therefore, a working solution for a minimum of 16 pages would be:

1. Calculate the number of pages by putting \AMCqlabel{paperends} at the end of the latex file (before the } of \onecopy{1}{ and \end{document})

\AMCqlabel{paperends} 
}
\end{document}

2. For a document of a minimum of 16 pages: put the following code before the \AMCqlabel{paperends}

\ifthenelse{\equal{\AMCpageref{paperends}}{11}}{\forntimes{5}{\blankbookpage}}{}
\ifthenelse{\equal{\AMCpageref{paperends}}{12}}{\forntimes{4}{\blankbookpage}}{}
\ifthenelse{\equal{\AMCpageref{paperends}}{13}}{\forntimes{3}{\blankbookpage}}{}
\ifthenelse{\equal{\AMCpageref{paperends}}{14}}{\forntimes{2}{\blankbookpage}}{}
\ifthenelse{\equal{\AMCpageref{paperends}}{15}}{\forntimes{1}{\blankbookpage}}{}

The command uses the total number of pages (\AMCpageref{paperends}) and adds a defined number of blank pages if the total number of pages equals a defined number. So, the first line defines that 5 blank pages should be added if the total number of pages is 11.

3. To define the macros "\forntimes" and "\blankbookpages" put the following code in the preamble of the document (before \begin{document}). In order to do so, the packages "forntimes" and "pgffor" are needed

\usepackage{ifthen} 
\usepackage{pgffor} 

\newcommand{\forntimes}[2]{
    \foreach \n in {1,...,#1}{#2}}
\newcommand{\blankbookpage}{\newpage \tiny \underline{\textsc{Space For Rough Work}}}

RE: Make every realization have same number of pages - Added by Alexis Bienvenüe about 8 years ago

It would be conveninet for end users if the above is included as a macro in AMC

From version hg:4c043e0885fd, you can use \AMCaddpagesto{16} at the end of the student's test description.

(1-3/3)