How to stop output generation after the first page?

by ceving   Last Updated April 15, 2019 10:23 AM

I need to render labels. My labels are 102mm * 152mm. When the input is too long, TeX creates two pages. But I can not print on two labels. So I would like to throw away everything but the first page.

How can I tell TeX to render just one single page?

Example:

\pdfpagewidth=102mm
\pdfpageheight=152mm

\hsize=\pdfpagewidth   \advance\hsize by -1cm
\vsize=\pdfpageheight  \advance\vsize by -1cm

\advance\hoffset by -1in  \advance\hoffset by 5mm
\advance\voffset by -1in  \advance\voffset by 5mm

\parindent=0pt
\nopagenumbers
\emergencystretch 3em

\font\tenrm="CMU Sans Serif" at 12pt
\rm

Lorem dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed
diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
takimata sanctus est Lorem ipsum dolor sit amet.

Lorem dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed
diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
takimata sanctus est Lorem ipsum dolor sit amet.

Lorem dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed
diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
takimata sanctus est Lorem ipsum dolor sit amet.

\bye
Tags : xetex plain-tex


Answers 1


You can use the atbegshi package:

\input atbegshi.sty

\pdfpagewidth=102mm
\pdfpageheight=152mm

\hsize=\pdfpagewidth   \advance\hsize by -1cm
\vsize=\pdfpageheight  \advance\vsize by -1cm

\advance\hoffset by -1in  \advance\hoffset by 5mm
\advance\voffset by -1in  \advance\voffset by 5mm

\parindent=0pt
\nopagenumbers
\emergencystretch 3em

\font\tenrm="CMU Sans Serif" at 12pt
\rm

\AtBeginShipoutFirst{\AtBeginShipout{\AtBeginShipoutDiscard}}%
Lorem dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed
diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
takimata sanctus est Lorem ipsum dolor sit amet.

Lorem dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed
diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
takimata sanctus est Lorem ipsum dolor sit amet.

Lorem dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed
diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem
ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
takimata sanctus est Lorem ipsum dolor sit amet.

\bye
Ulrike Fischer
Ulrike Fischer
April 15, 2019 10:07 AM

Related Questions


Updated June 11, 2015 23:10 PM

Updated June 12, 2015 01:10 AM

Updated April 12, 2019 13:23 PM

Updated April 14, 2019 00:23 AM

Updated June 12, 2015 06:10 AM