0

I am typesetting exams for secondary school students. The idea is to use exercise.sty to be able to print the answers on the back of the "exam sheet" during a tutorial.

I also want to save paper: as each "exam" contains only 2-3 problems, they fit in a half of A4 - so, the idea is to have two "exam sheets" per A4 and then cut the paper in the middle.

My hope was that the \shipoutExercise command of exercise.sty would allow printing the problems twice. However it does not. The code below typesets the problems (and the answers) only once.

Is it possible to find a workaround for this issue?

Minimal (not) working example:

\documentclass[12pt]{article}

\pagestyle{empty}

\usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}

\begin{document}

\begin{Exercise}
 This is problem's text: how many?
\end{Exercise}
\begin{Answer}
 5 pieces
\end{Answer}

\shipoutExercise % print problems the 1st time

\shipoutExercise % print them the second time

%-------------
\newpage
\shipoutAnswer % print answers the first time

\shipoutAnswer % print them the second time


\end{document}

This is a simplified version. In the real life, the \shipout... commands will be wrapped in minipage to fill exactly 50% of an A4 page.

0

I have found a quick and dirty solution: by redefining the \shipout... commands in my document and making sure the corresponding boxes not get emptied after being typeset.

\makeatletter
\renewcommand{\shipoutExercise}{%
\global\setbox\temp@Exercisebox\copy\all@Exercisebox%
\if@ExerciseOutput\unvbox\all@Exercisebox\fi%
\global\setbox\all@Exercisebox\copy\temp@Exercisebox%
}
\renewcommand{\shipoutAnswer}{%
\global\setbox\temp@Answerbox\copy\all@Answerbox%
\if@AnswerOutput\unvbox\all@Answerbox\fi%
\global\setbox\all@Answerbox\copy\temp@Answerbox%
}
\makeatother

Hopefully, there is a better (more elegant - e.g., with package options?) solution.

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.