# [texhax] Repeating an environment

Stefan Björk stefan.bjork at gmail.com
Fri May 1 05:42:03 CEST 2009

2009/4/29 Herbert Voss <Herbert.Voss at fu-berlin.de>:
> \documentclass{article}
> \usepackage{multido}
> \newsavebox\TBox
> \newcommand*\RepeatN{}
> \newenvironment{Repeat}[1][1]
>  {\renewcommand*\RepeatN{#1}%
>   \begin{lrbox}{\TBox}
>   \begin{minipage}{\linewidth}}
>  {\end{minipage}\end{lrbox}%
>   \multido{\iA=0+1}{\RepeatN}{\usebox\TBox\endgraf}}
> \begin{document}

Thanks -- but this is still not really what I'm looking for, since --
as far as I know -- minipages can not span pages? What I am looking
for is a functionality similar to the standard letter class. The
purpose is to create an exam (which spans some 15--20 pages) in
several copies with a unique code (counter) on each copy.

However, I have solved this with a little perl program that creates
multiple copies of the source TeX file, compiles them and sends them
to the printer. I found that this approach is a major advantage over a
huge PDF, since separate print jobs makes it possible to use the
automatic stapling functions of the printer. Saves a lot of work!

Anyway, thank you for all suggestions!

/S