10

I often make A5 size hand outs for my students. I would like the A5 page to be directly compiled to have a copy of the original A5 page on one A4 page. Up till now my solution has been to make a second document handling the copying with the pdfpages package. Could this be automatized to yield two similar A5 pages on a A4 page upon one compilation? The document will always fit one A5 page.

The original A5 document:

\documentclass[a5paper,12pt,norsk]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel,fouriernc,parskip,booktabs,array}
\usepackage[margin=1cm,landscape]{geometry}
\usepackage{enumitem}
\setlist{nolistsep}
\renewcommand\labelitemi{--}

\begin{document}
\thispagestyle{empty}
{\Large <<Jeg kan>> om kjemi}

\vspace{1em}
\begin{center}
\begin{tabular}{p{0.7\textwidth} |>{\centering}p{0.1\textwidth}| >{\centering}p{0.1\textwidth}}
    \toprule
    \textbf{Spørsmål} & \textbf{ja} & \textbf{nei} \tabularnewline
    \hline
    \dots some text & & \tabularnewline
    \bottomrule
\end{tabular}
\end{center}
\end{document}

The "printout" document to collect the A5 sheets on one piece of A4 paper

\documentclass[a4paper]{article}
\usepackage{pdfpages}
\usepackage[margin=0cm,showframe]{geometry}
\begin{document}
    \includepdf[nup=1x2,pages={1,1}]{jegKan}
    % \includepdf{vurderingsskjema}
\end{document}
Holene
  • 6,920
  • Do you want to do two copies of the same A5 page inside a single A4 page? – Sigur Nov 04 '13 at 12:14
  • Maybe this post can help you: http://tex.stackexchange.com/questions/59843/two-pages-per-sheet-brochure – DG' Nov 04 '13 at 12:25
  • @Sigur Yes, that is correct! – Holene Nov 04 '13 at 15:51
  • @Holene, you can print it in a pdf file and choose the properties to do this. Choose two copies and use the booklet option. – Sigur Nov 04 '13 at 15:59
  • That's what I also thought, @Sigur. It's not that easy printing from my crappy work computer, and it also lines up with "unnecessary" mouse usage. I would very much find a way to compile two A5 documents in one A4 page. – Holene Nov 04 '13 at 16:13
  • Do you use linux? – Sigur Nov 04 '13 at 16:21
  • I have not yet understood what exactly you want to automate. The generation of the second LaTeX document? Are you open to use tools like pdfnup (easily available on Linux/MacOS, require Cygwin on Windows). Maybe this answer could help you regarding the automation. – Daniel Nov 04 '13 at 16:49
  • I'm on unix, yes. @Daniel I would like to achieve two A5 pages which are copies of each other on one A4 page by compiling only one document. Right now I'm compiling two documents. It feels like that job should be able to be redirected. And it's annoying :p – Holene Nov 04 '13 at 17:39
  • Is the document always just a single page long? – Daniel Nov 04 '13 at 23:02
  • @Daniel Yes. The purpose of the document is to have a short set of tasks such that the students don't feel overwhelmed when faced with it. So this document will always fit one A5 page. – Holene Nov 05 '13 at 07:04

3 Answers3

11

The following uses, as also suggested by DG', the pgfpages package to do the 1x2 A5 on A4 layout, but automatically duplicates the content of each A5 page at shipout time, so that you end up with two identical A5 copies on each A4 page.

It also works with multi-page documents.

\documentclass[a5paper,12pt,norsk]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel,fouriernc,parskip,booktabs,array}
\usepackage[margin=1cm,landscape]{geometry}
\usepackage{enumitem}

\usepackage{pgfpages}                                 % <— load the package
  \pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm] % <— set options

\usepackage{atbegshi}
  % duplicate the content at shipout time
  \AtBeginShipout{
    \pgfpagesshipoutlogicalpage{1}\copy\AtBeginShipoutBox
    \pgfpagesshipoutlogicalpage{2}\box\AtBeginShipoutBox
    \pgfshipoutphysicalpage
  }

\usepackage{blindtext}


\setlist{nolistsep}
\renewcommand\labelitemi{--}

\begin{document}
\thispagestyle{empty}
{\Large <<Jeg kan>> om kjemi}

\vspace{1em}
\begin{center}
\begin{tabular}{p{0.7\textwidth} |>{\centering}p{0.1\textwidth}| >{\centering}p{0.1\textwidth}}
    \toprule
    \textbf{Spørsmål} & \textbf{ja} & \textbf{nei} \tabularnewline
    \hline
    \dots some text & & \tabularnewline
    \bottomrule
\end{tabular}
\end{center}

% To demonstrate that it also works with multiple pages
\newpage

\blindtext

\end{document}

enter image description here

Remark: If your a5 pages are portrait, then the setup is:

\documentclass[a5paper]{article}
...
\usepackage[margin=1cm,portrait]{geometry}
...
\usepackage{pgfpages}
\pgfpagesuselayout{2 on 1}[a4paper,landscape,border shrink=5mm]
...

A5 portrait on double A4

Daniel
  • 37,517
  • It works. Is there a way to avoid errors LaTeX Warning: Label pgfid1 multiply defined. LaTeX Warning: Ignoring void shipout box.? – Pygmalion Dec 18 '23 at 20:11
7

UPDATE: Added code to duplicate the page. But you should use @Daniels solution as it is much more versatile.

You could use pgfpages:

\documentclass[a5paper,12pt,norsk]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel,fouriernc,parskip,booktabs,array}
\usepackage[margin=1cm,landscape]{geometry}

\usepackage{forloop}                                  % <-- needed to duplicate page 
\usepackage{pgfpages}                                 % <-- load the package
\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm] % <-- set options

\usepackage{enumitem}
\setlist{nolistsep}
\renewcommand\labelitemi{--}

\begin{document}

\newcounter{counter}
\forloop{counter}{0}{\value{counter} < 2}{% <-- Print the page twice
    \thispagestyle{empty}
    {\Large <<Jeg kan>> om kjemi}
    \vspace{1em}
    \begin{center}
    \begin{tabular}{p{0.7\textwidth} |>{\centering}p{0.1\textwidth}| >{\centering}p{0.1\textwidth}}
        \toprule
        \textbf{Spørsmål} & \textbf{ja} & \textbf{nei} \tabularnewline
        \hline
        \dots some text & & \tabularnewline
        \bottomrule
    \end{tabular}
    \end{center}
    \clearpage
}
\end{document}

This results in:

enter image description here

DG'
  • 21,727
  • When I compile this with pdflatex, I just get a three pages A4 document. – Daniel Nov 05 '13 at 10:47
  • @Daniel are you sure, that you haven’t got five a5 pages (landscape) on three a4 sheets (portrait)? – DG' Nov 05 '13 at 11:16
  • You are right, I was confused. However, as far as I understand, the OP wants to have content spanning one logical A5 landscape page to be duplicated so that he ends with one physical A4 portrait page containing two instances of the (same) logical A5 page side by side. – Daniel Nov 05 '13 at 11:26
  • You are right, it appears that he wants identical pages, although he writes similar . . . – DG' Nov 05 '13 at 11:30
1

The pgfmorepage (github, ctan) extension of pgfpages can handle this, including the duplication of the pages.

\documentclass[a5paper,12pt,norsk]{article}
%\url{https://tex.stackexchange.com/q/142187/86}
\usepackage[utf8]{inputenc}
\usepackage{babel,fouriernc,parskip,booktabs,array}
\usepackage[margin=1cm,landscape]{geometry}
\usepackage{enumitem}
\setlist{nolistsep}
\renewcommand\labelitemi{--}

\usepackage{pgfmorepages} \pgfmorepagesloadextralayouts \pgfpagesuselayout{repeated 2-up}[a4paper]

\begin{document} \thispagestyle{empty} {\Large <<Jeg kan>> om kjemi}

\vspace{1em} \begin{center} \begin{tabular}{p{0.7\textwidth} |>{\centering}p{0.1\textwidth}| >{\centering}p{0.1\textwidth}} \toprule \textbf{Spørsmål} & \textbf{ja} & \textbf{nei} \tabularnewline \hline \dots some text & & \tabularnewline \bottomrule \end{tabular} \end{center} \end{document}

Two pages on one

Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751