# Multiple copies of short page on one sheet of paper

Suppose you have a short document (including a fancy header) which occupies only a small part of a DIN A4 page, like in this example:

\documentclass[a4paper, 12pt]{article}

\usepackage[top=2cm,hmargin=2.2cm]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{}

\begin{document}
short text  short text  short text short text  short
text  short text  short text  short text  short text  short
text  short text short text  short text  short text  short
text short text  short text  short text  short text  short
text  short text  short text  short text  short text end of the text.
\end{document}


Suppose I want to print this text 50 times. To save paper I would print it and use a photocopier to copy this text incl. fancy header several times to one sheet of paper.

Now my question is, if there is a simple LaTeX way to do this, i.e. in the above example, have as many copies of all text from fancy header to "end of the text" automatically on a DIN A4 sheet as you can fit on it?

-

I do not know an fully automatically way, but it is possible to do it manually with minimal adjustments.

# First way:

Reduce the height of the page to the minimal height by replacing a4paper with pagewidth=21cm,pageheight=4cm (here 21cm is the A4 width and 4cm depends on the text content and margin requirements).

\usepackage[top=2cm,hmargin=2.2cm,paperwidth=21cm,paperheight=4cm]{geometry}


Then create a second small LaTeX document which includes the PDF of the first using the pdfpages pages and places it multiple times on one page:

\documentclass[a4paper]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[page={1,1,1,1,1,1,1},nup=1x7]{mainfile}
\end{document}


This places the first document (called mainfile.tex/.pdf here) seven times on page. Adjust both the number of 1, and the number of nup=1x to the real number which fit on one page.

# Second way:

You could create the headers using normal text instead so it can be repeated over the page. A tabular would be adequate here. Putting the main text into one multi-column cell also prevents page breaks inside the text. The the text could be repeated using a loop. Adjust the \vspaces and the repeat numbers to fit your requirements.

\documentclass[a4paper, 12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[pdftex]{graphicx}
\usepackage[top=2cm,hmargin=2.2cm]{geometry}
\pagestyle{empty}

\begin{document}

\newcount\num
\loop\ifnum\num<7
\par\noindent
\begin{tabular}{@{}l@{}r@{}}
\hline\noalign{\vspace{.5cm}}
\multicolumn{2}{@{}p{\linewidth}@{}}{%
\hspace*{\parindent}% if par indent is required
short text  short text  short text short text  short
text  short text  short text  short text  short text  short
text  short text short text  short text  short text  short
text short text  short text  short text  short text  short
text  short text  short text  short text  short text end of the text
}
\end{tabular}
\par\vspace{1cm}%
\repeat

\end{document}

-
The problem I am finding with this (2nd) solution is, if I put a \ in the text, I get endless stream of errors given below ... see removed non-answer –  Tem Pora Nov 24 '12 at 6:56

I found another solution to be simpler, I want to have everything in one file which simplifies everythingh. With the pdfpages solution that is not possible. Simply define the text you want to repeat as a command, with \newcommand{\repeatthis}{text}, and then simply use that command multiple times. As a complete example, I show the complete file for a yahtzee scoresheet, using this technique:

% yahtzee-scoresheet in \LaTeX
\documentclass[a4,12pt,landscape,pdftex]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{array}%%%%%Extended, modernized version of tabular
\usepackage[misc]{ifsym}%%%%%\Cube{} command
%%%%% Defining commands for yatzee names:
\newcommand{\one}{\Cube{1}}
\newcommand{\two}{\Cube{2}}
\newcommand{\three}{\Cube{3}}
\newcommand{\four}{\Cube{4}}
\newcommand{\five}{\Cube{5}}
\newcommand{\six}{\Cube{6}}
\newcommand{\onepair}{\Cube{1}\Cube{1}}
\newcommand{\twopair}{\Cube{2}\Cube{2}~\Cube{3}\Cube{3}}
\newcommand{\thrice}{\Cube{3}\Cube{3}\Cube{3}}
\newcommand{\fourequal}{\Cube{4}\Cube{4}\Cube{4}\Cube{4}}
\newcommand{\house}{\onepair{}~\thrice}
\newcommand{\straight}{\Cube{1}\Cube{2}\Cube{3}\Cube{4}\Cube{5}}
\newcommand{\sstraight}{\Cube{2}\Cube{3}\Cube{4}\Cube{5}\Cube{6}}
\newcommand{\yatzee}{\Cube{6}\Cube{6}\Cube{6}\Cube{6}\Cube{6}}
\newcommand{\chance}{\textbf{sjanse}}
\newcommand{\bonus}{\textbf{bonus}}
\newcommand{\total}{\textbf{sum}}
\dimen0=0.6cm{}  %%%%% To use within the tabular environment
\newcommand{\onesheet}{%%%%% The complete score sheet:
\begin{tabular}[t]{||l||p{\dimen0}|p{\dimen0}|p{\dimen0}|p{\dimen0}|p{\dimen0}|p{\dimen0}||}\hline \hline
& & & & & &   \\   \hline
\one       & & & & & &   \\   \hline
\two       & & & & & &   \\   \hline
\three     & & & & & &   \\   \hline
\four      & & & & & &   \\   \hline
\five      & & & & & &   \\   \hline
\six       & & & & & &   \\   \hline \hline
\total     & & & & & &   \\   \hline
\bonus     & & & & & &   \\   \hline  \hline
\onepair   & & & & & &   \\   \hline
\twopair   & & & & & &   \\   \hline
\thrice    & & & & & &   \\   \hline
\fourequal & & & & & &   \\   \hline
\house     & & & & & &   \\   \hline
\straight  & & & & & &   \\   \hline
\sstraight & & & & & &   \\   \hline
\yatzee    & & & & & &   \\   \hline
\chance    & & & & & &   \\   \hline \hline
\total     & & & & & &   \\   \hline \hline
\end{tabular}
}
\begin{document}
\onesheet  \\[15mm]
\onesheet
\end{document}

-
So how do you replicate the header/footer the way the OP requested? In that sense your approach doesn't solve the problem. –  Werner Jan 12 at 20:48