1

I'm trying to make some invitation cards and place eight copies on a single a4 page for printing. The invite was created on an a5 size page (since I also want some a5 copies), and I tried using pgfpages to shrink down the eight a5 pages and combine them onto one a4 page.

The problem is that when I compile the code the text on the eight sub-pages is obviously not centered (although it is centered when compiling the pages individually), and there is spacing placed between the eight pages (which I guess is what I would want if I were making handouts from a presentation, but not in the present context). See the following MWE:

\documentclass[a5paper, landscape]{article}

\usepackage{pgfpages}
\usepackage{pgffor}
\pgfpagesuselayout{8 on 1}[a4paper]
\pagestyle{empty}

\newcommand{\Invite}{\begin{centering}
Please come to my party
\end{centering}}

\begin{document}
\Invite
\foreach \n in {1, ..., 7}{\newpage \Invite}
\end{document}

What I'd like is just eight copies of the original invite, shrunk to half size and placed tight side by side, so that once printed I can simply cut the page into eight equal pieces and get identical copies of the same card.

Any suggestions on how I can achieve this would be gratefully received!

Added later:

Thanks for the comments and answer relating to my use of centering; adding \par as suggested fixes the problem in the MWE. However there is still an issue when I go back to my real code. I think the problem is to do with the margins. On the individual pages I adjusted the margins so I could fit large text on, but this seems to be messing things up when I use pgfpages. The following code illustrates the problem:

\documentclass[a5paper, landscape]{article}

\usepackage{pgffor}
\usepackage{pgfpages}
\pgfpagesuselayout{8 on 1}[a4paper]

\addtolength{\textwidth}{5cm}
\addtolength{\hoffset}{-2.5cm}
\addtolength{\textheight}{6cm}
\addtolength{\voffset}{-2.6cm}
\pagestyle{empty}

\newcommand{\Invite}{\centering
\vspace*{100pt}
\Huge Invitation
\par}

\begin{document}
\Invite
\foreach \n in {1, ..., 7}{\newpage \Invite}
\end{document}

Commenting out the 8 on 1 line gives eight separate pages with nicely positioned text, but when this line is put back in and the eight pages are combined the text is no longer correctly positioned on each subpage.

I tried moving the \addtolength lines to before the 8 on 1 line but this doesn't help. Is there a way to fix this?

  • from your code it's the original there is no problem related to pgfpages, may be the problem is in the original code of \Invite. Try without pgfpages when you get 8 pages (invitation cards) then add \usepackage{pgfpages} \pgfpagesuselayout{8 on 1}[a4paper] – touhami Nov 18 '15 at 23:15
  • 1
    Either use \centering <text>\par or use \begin{center}<text>\end{center}. You never end the paragraph, so \centering is never applied. – cfr Nov 19 '15 at 3:25
  • 1
    Have you tried using geometry rather than adjusting the margins directly? – cfr Nov 19 '15 at 13:58
  • @cfr Great, thanks very much! This fixes it. – Jez Nov 19 '15 at 19:15
  • Good - I've updated the answer with an edit in case anybody else wants to final solution ;). I've also tried to demonstrate what is going on a bit with showframe and your revised code. – cfr Nov 19 '15 at 21:53
3

pgfpages does the job fine:

8 up

The text in no page is centred because \centering is applied when the paragraph ends, but you issue \newpage without ending the paragraph.

\centering
First way
\par

\begin{center}
Second way
\end{center}

The second method adds vertical spacing while the first does not.

For example:

8 up centred

Code:

\documentclass[a5paper, landscape]{article}
% \usepackage{showframe}
\usepackage{pgfpages}
\usepackage{pgffor}
\pgfpagesuselayout{8 on 1}[a4paper]
\pagestyle{empty}

\newcommand{\Invite}{%
  \begin{center}
    Please come to my party
  \end{center}}

\begin{document}
\Invite
\foreach \n in {1, ..., 7}{\newpage \Invite}
\end{document}

EDIT

In the code posted in the updated part of the question, we can visualise the problem by adding \usepackage{showframe}:

problem re. updated part of question

This off-centre-ness is due to the \hoffset and \voffset. I'm not sure what these are intended to do exactly, but the problem is there in the original A5 document:

problem shown in original

The best way to handle this is not directly but using a package which will do the necessary calculations for you. For example

\usepackage{geometry}
\geometry{textwidth=50mm,textheight=60mm}

which will also pick up a5paper or whatever from the class options and ensure that it is taken account of properly. (LaTeX doesn't get this right on its own.)

Then a single page looks like this:

adjusted page

and the 8-up page like this:

8-up page, adjusted

which is probably what you want. Except for the frames which are just to demonstrate the layout:

final 8-up page, adjusted without frames

Complete code:

\documentclass[a5paper, landscape]{article}
\usepackage{pgffor}
\usepackage{pgfpages}
\pgfpagesuselayout{8 on 1}[a4paper]
\pagestyle{empty}
%\usepackage[showframe]{geometry}
\usepackage{geometry}
\geometry{textwidth=50mm,textheight=60mm}

\newcommand{\Invite}{%
  \centering
  \vspace*{100pt}
  \Huge Invitation
  \par
}

\begin{document}
\Invite
\foreach \n in {1, ..., 7}{%
  \newpage
  \Invite
}
\end{document}
  • Thanks for this answer; it partly solves the problem (it completely solves the problem in the MWE, but not in my real code). I've edited my post to explain the new issue. – Jez Nov 19 '15 at 8:38

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.