Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to create sheets of labels using pgfpages but, apparently, I'm doing it wrong. Here is what I have tried:

\documentclass{article}
\usepackage[paperwidth=2in,paperheight=2in,nohead,nofoot]{geometry}
\pagestyle{empty}

\usepackage{pgf}
\usepackage{pgfpages}

% Layout from http://www.onlinelabels.com/OL3016.htm
\pgfpagesdeclarelayout{OL3016}
{
  \edef\pgfpageoptionheight{\the\paperheight}%
  \edef\pgfpageoptionwidth{\the\paperwidth}%
  \edef\pgfpageoptionborder{0pt}%
  \edef\labelheight{2in}%
  \edef\labelwidth{2in}%
  \edef\labelmargin{0.25in}%
  \edef\labelxsep{1in}%
  \edef\labelysep{0.8333in}%
}
{
  \pgfpagesphysicalpageoptions
  {%
    logical pages=12,%
    last logical shipout=12,
    physical height=\pgfpageoptionheight,%
    physical width=\pgfpageoptionwidth,%
    current logical shipout=1,%
  }
%
  \pgfpageslogicalpageoptions{1}
  {% 
    %copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{1.25in}{1.25in}%
  }%
  \pgfpageslogicalpageoptions{2}
  {%
    copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{4.25in}{1.25in}%
  }%
  \pgfpageslogicalpageoptions{3}
  {%
    copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{7.25in}{1.25in}%
  }%
%
  \pgfpageslogicalpageoptions{4}
  {% 
    copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{1.25in}{3.25in+\labelysep}%
  }%
  \pgfpageslogicalpageoptions{5}
  {%
    copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{1.25in+3in}{3.25in+\labelysep}%
  }%
  \pgfpageslogicalpageoptions{6}
  {%
    copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{7.25in}{3.25in+\labelysep}%
  }%  
%  
  \pgfpageslogicalpageoptions{7}
  {% 
    copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{1.25in}{5.25in+2*\labelysep}%
  }%
  \pgfpageslogicalpageoptions{8}
  {%
    copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{4.25in}{5.25in+2*\labelysep}%
  }%
  \pgfpageslogicalpageoptions{9}
  {%
    copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{7.25in}{5.25in+2*\labelysep}%
  }%  
%  
  \pgfpageslogicalpageoptions{10}
  {% 
    copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{1.25in}{7.25in+3*\labelysep}%
  }%
  \pgfpageslogicalpageoptions{11}
  {%
    copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{4.25in}{7.25in+3*\labelysep}%
  }%
  \pgfpageslogicalpageoptions{12}
  {%
    copy from=1,%
    border code=\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=\labelwidth,%
    resized height=\labelheight,%
    center=\pgfpoint{7.25in}{7.25in+3*\labelysep}%
  }%  
}


\pgfpagesuselayout{OL3016}[letterpaper]

\begin{document}

This is my label 1.\clearpage
This is my label 2.\clearpage
This is my label 3.\clearpage
This is my label 4.\clearpage
This is my label 5.\clearpage
This is my label 6.\clearpage
This is my label 7.\clearpage
This is my label 8.\clearpage
This is my label 9.\clearpage
This is my label 10.\clearpage
This is my label 11.\clearpage
This is my label 12.\clearpage
This is my label 13.\clearpage

\end{document}

I was expection to have one sheet with 12 copies of the same label (because of the copy from option). What I am getting is the first physical page with label 1 -- 12 and the next with label 13 and eleven label 1.

Can pgfpages be used to declare a layout with 12 copies of the same logical page on each physical page?

share|improve this question
    
Sorry, not an answer, but that looks like an extremely complicated solution to a relatively simple problem. Is there any reason you can't use the labels package? –  Brent.Longborough Mar 25 '13 at 10:58
    
@Brent.Longborough: You are right. Putting labels on a grid is not a difficult problem and can be done in many ways. I am currently doing something very similar to what Ignasi suggests in his answer (i.e. a two-document process). However, a pgfpages solution would allow me to make a small package declaring the layouts for each of the label sheets that I am using. Stating \pgfpagesuselayout{OL3016} in the preamble of any document would then rearrange it for printing on OL3016 labels. No special markup would be needed in the document. –  Martin Heller Mar 25 '13 at 13:00
    
I've updated my answer. May be still not what you want, but I hope it could help. –  Ignasi Mar 25 '13 at 17:16
add comment

1 Answer

up vote 1 down vote accepted

This is not an answer but another solution to your problem. What I propose is to draw all your labels in a file and make copies with pdfpages package help.

Your labels file will be:

%----labels.tex ---------%
\documentclass{article}
\usepackage[paperwidth=2in,paperheight=2in,nohead,nofoot]{geometry}
\pagestyle{empty}
\begin{document}
\thispagestyle{empty}
This is my label 1.\clearpage
This is my label 2.\clearpage
This is my label 3.\clearpage
This is my label 4.\clearpage
This is my label 5.\clearpage
This is my label 6.\clearpage
This is my label 7.\clearpage
This is my label 8.\clearpage
This is my label 9.\clearpage
This is my label 10.\clearpage
This is my label 11.\clearpage
This is my label 12.\clearpage
This is my label 13.\clearpage
\end{document}

After creating your labels.pdf, create a printlabels.tex with:

%----printlabels.tex----------
\documentclass[letter]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages={1-13},% which labels do you want to print
    delta=.5in 0.8333in,% space between copies
    frame,% comment if don't want frames
   noautoscale,% keep original labels size
   nup=3x4,% how many labels on physical page
   duplicatepages=12 % how many copies of same label
]{labels.pdf}
\end{document}

pdflatex it and you will get what you want: a 13 pages pdf file with 12 copies of one label in each page.

Update:

Applying Herbert's answer to Can you make the "graphic" option of LTXinputExample able to render all pages of a multi-page PDF file?, it's possible to reduce my previous answer to one file processed once.

With filecontents package, labels.tex file is included in printlabels.tex and processed with \immediate\write18{pdflatex lables.tex} command. After that labels are replicated with pdfpages command.

You only need to change geometry options to fix labels size.

\documentclass[letter]{article}

\usepackage{filecontents}
\begin{filecontents*}{mylabels.tex}
\documentclass{article}
\usepackage[paperwidth=2in,paperheight=2in,nohead,nofoot]{geometry}
\pagestyle{empty}
\begin{document}
\thispagestyle{empty}
This is my label 1.\clearpage
This is my label 2.\clearpage
This is my label 3.\clearpage
This is my label 4.\clearpage
This is my label 5.\clearpage
This is my label 6.\clearpage
This is my label 7.\clearpage
This is my label 8.\clearpage
This is my label 9.\clearpage
This is my label 10.\clearpage
This is my label 11.\clearpage
This is my label 12.\clearpage
This is my label 13.\clearpage
\end{document}
\end{filecontents*}

\immediate\write18{pdflatex mylabels.tex}

\usepackage{pdfpages}
\begin{document}
\includepdf[pages={1-13},%
    delta=.5in 0.8333in,%
    frame,%
   noautoscale,%
   nup=3x4,%
    duplicatepages=12]{mylabels.pdf}
\end{document}
share|improve this answer
    
Thank you for your suggested approach to the problem and the solution which I will adapt to suit my needs. Including the labels in a filecontents environment is a nice trick. –  Martin Heller Mar 26 '13 at 8:08
    
@MartinHeller Glad to help you! –  Ignasi Mar 26 '13 at 8:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.