The eso-pic package^{∗}

Rolf Niepraschk^{∗∗}

Abstract

This package makes it easy to add some picture commands to every page.

1 Introduction

This package is an extension to Martin Schröder’s everyshi package. Using everyshi’s \EveryShipout command eso-pic adds one or more userdefined picture commands to L^{A}TEX’s shipout routine.

2 Usage

AddToShipoutPicture All the picture commands which are parameters of an \AddToShipoutPicture command will be added to the internal macro \ShipoutPicture@Hook. This macro is part of a zero-length picture environment with basepoint at the lower left corner of the page (similar to postscript). The picture environment will

ClearShipoutPicture be shipped out at every new page. A call of \ClearShipoutPicture clears the

contents of \ShipoutPicture@Hook.

3 Implementation

1 ⟨∗package⟩

 2 \NeedsTeXFormat{LaTeX2e}[1995/01/25]
 3 \ProvidesPackage{eso-pic}
 4 [1998/07/11 v0.5 eso-pic -- extension to `everyshi' (RN)]

5

 6 \RequirePackage{everyshi}[1995/01/25]

7

 8 \newcommand{\@ShipoutPicture@Hook}{}
 9 \newcommand{\AddToShipoutPicture}{\g@addto@macro\@ShipoutPicture@Hook}
10 \newcommand{\ClearShipoutPicture}{\let\@ShipoutPicture@Hook\@empty}
11 \newcommand{\@ShipoutPicture}{%
12 \ifx\@ShipoutPicture@Hook\@empty
13 \else
14  \bgroup
15  \@tempdima=1in
16  \@tempcnta=\@tempdima
17  \@tempcntb=-\@tempdima

∗This file has version number v0.5, last revised 1998/07/11.

∗∗niepraschk@ptb.de

18  \advance\@tempcntb\paperheight
19  \global\setbox\@cclv\vbox{%
20  \vbox{%
21  \unitlength=1sp%
22  \begin{picture}(0,0)(\@tempcnta,\@tempcntb)%
23  \let\protect\relax\@ShipoutPicture@Hook%
24  \end{picture}}%
25  \box\@cclv%
26  }%
27  \egroup
28 \fi

29 }

30

31 \EveryShipout{\@ShipoutPicture}

32 ⟨/package⟩

4 Test file

eso-p-t.tex Produced framed pages.

33 ⟨∗demo⟩

34 \documentclass[a4paper]{article}
35 \usepackage{eso-pic,calc}
36 \listfiles

37

38 \makeatletter
39 \AddToShipoutPicture{%
40  \setlength{\@tempdima}{15mm}
41  \setlength{\@tempdimb}{\paperwidth-2\@tempdima}
42  \setlength{\@tempdimc}{\paperheight-2\@tempdima}
43  \setlength{\unitlength}{1pt}\thicklines%
44  \put(\strip@pt\@tempdima,\strip@pt\@tempdima){%
45  \framebox(\strip@pt\@tempdimb,\strip@pt\@tempdimc){}

46 } 47 }

48 \makeatother

49

50 \begin{document}

51

52 \section*{First page}

53

54 This page and all the following have a frame with 15~mm
55 distance from the paper edges.\newpage

56

57 \section*{Second page} \newpage

58

59 \section*{Last page}
60 \end{document}

61 ⟨/demo⟩