The eso-pic package^{∗}

Rolf Niepraschk

                (email: niepraschk@ptb.de)

Abstract

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

Contents

1 Introduction 1

2 Usage 1

3 Implementation 1

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 \ESO@HookI. 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 be shipped out at every new page.

\ClearShipoutPicture  A call of \ClearShipoutPicture clears the contents of \ESO@HookI.
\AddToShipoutPicture*      \AddToShipoutPicture* works like \AddToShipoutPicture but only for the

current page. It used the internal macro \ESO@HookII which contents will be removed automatically.

\LenToUnit Allows a length as parameter to a picture command. \AtPageUpperLeft Some helper macros for easier positioning to importend points of the page.

\AtPageCenter
\AtTextUpperLeft
\AtTextCenter

3 Implementation

1 ⟨∗package⟩

 2 %

∗This file has version number v1.0a, last revised 2002/10/07.

 4 \NeedsTeXFormat{LaTeX2e}[1995/01/25]

5

 6 \ProvidesPackage{eso-pic}[2002/10/07 v1.0a eso-pic (RN)]

7

 8 \RequirePackage{everyshi}

9

\LenToUnit
10 \newcommand\LenToUnit[1]{#1\@gobble}
\AtPageUpperLeft
11 \newcommand\AtPageUpperLeft[1]{%
12 \begingroup
13  \@tempdima=0pt\relax\@tempdimb=\paperheight\relax
14  \put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimb}){#1}%
15 \endgroup

16 }

\AtPageCenter
17 \newcommand\AtPageCenter[1]{%
18 \begingroup
19  \@tempdima=.5\paperwidth\@tempdimb=.5\paperheight
20  \put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimb}){#1}%
21 \endgroup

22 }

\AtTextUpperLeft
23 \newcommand\AtTextUpperLeft[1]{%
24 \begingroup
25  \setlength\@tempdima{1in}%
26  \ifodd\c@page%
27  \advance\@tempdima\oddsidemargin%
28  \else%
29  \advance\@tempdima\evensidemargin%
30  \fi%
31  \@tempdimb=\paperheight\advance\@tempdimb-1in\relax%
32  \advance\@tempdimb-\textheight\advance\@tempdimb-\topmargin%
33  \advance\@tempdimb-\headheight\advance\@tempdimb-\headsep%
34  \put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimb}){#1}%
35 \endgroup

36 }

\AtTextCenter
37 \newcommand\AtTextCenter[1]{%
38 \begingroup
39  \@tempdima=1in\relax
40  \ifodd\c@page%
41  \advance\@tempdima\oddsidemargin%
42  \else%
43  \advance\@tempdima\evensidemargin%
44  \fi%
45  \advance\@tempdima.5\textwidth%
46  \@tempdimb=\paperheight%

47  \advance\@tempdimb-.5\textheight%
48  \advance\@tempdimb-1in\relax%
49  \advance\@tempdimb-\topmargin%
50  \advance\@tempdimb-\headheight%
51  \advance\@tempdimb-\headsep%
52  \put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimb}){#1}%
53 \endgroup

54 }

55 \newcommand{\ESO@HookI}{}\newcommand{\ESO@HookII}{}
56 \newcommand{\AddToShipoutPicture}{%
57 \@ifstar{\g@addto@macro\ESO@HookII}{\g@addto@macro\ESO@HookI}}
58 % \changes{v1.0a}{2002/10/07}{Changed \cmd\let to
59 %   \cmd\global\let (suggested by Alberto.Lusiani@pi.infn.it).}
60 \newcommand{\ClearShipoutPicture}{\global\let\ESO@HookI\@empty}
61 \newcommand\ESO@isMEMOIR[1]{}
62 \@ifclassloaded{memoir}{\renewcommand\ESO@isMEMOIR[1]{#1}}{}
\@ShipoutPicture
63 \newcommand{\@ShipoutPicture}{%
64 \bgroup
65  \@tempswafalse%
66  \ifx\ESO@HookI\@empty\else\@tempswatrue\fi%
67  \ifx\ESO@HookII\@empty\else\@tempswatrue\fi%
68  \if@tempswa%
69  \@tempdima=1in\@tempdimb=-\@tempdima%
70  \advance\@tempdimb\paperheight

For compatibility with the memoir class (suggested by Andreas Matthias).

71  \ESO@isMEMOIR{%
72  \advance\@tempdima\trimedge%
73  \advance\@tempdima\paperwidth%
74  \advance\@tempdima-\stockwidth%
75  \if@twoside\ifodd\c@page\else%
76  \advance\@tempdima-2\trimedge%
77  \advance\@tempdima-\paperwidth%
78  \advance\@tempdima\stockwidth%
79  \fi\fi%
80  \advance\@tempdimb\trimtop}%
81  \unitlength=1pt%
82  \global\setbox\@cclv\vbox{%
83  \vbox{%
84  \let\protect\relax
85  \pictur@(0,0)(\strip@pt\@tempdima,\strip@pt\@tempdimb)%
86  \ESO@HookI\ESO@HookII\global\let\ESO@HookII\@empty%
87  \endpicture}%

The following command prevents a small vertical misplacement (suggested by Stephan Lehmke).

88  \nointerlineskip%
89  \box\@cclv%
90  }%
91  \fi
92 \egroup

93 }

94 \EveryShipout{\@ShipoutPicture}

95 ⟨/package⟩

Change History

v0.4

General: New . . . . . . . . . . . . . . . 1 v0.5

General: Some bug corrections … 1 v0.6

General: Some corrections for compatibility with the ‘html’ package suggested by Ross Moore and a licence note . . . . . . . . . . 1

v0.7

General:  New  command

\AddToShipoutPicture* . . . . . 1

v0.8

\@ShipoutPicture: Compatibility

with the memoir class. . . . . . . 3 v0.9

\@ShipoutPicture: \nointerlineskip

prevents a small vertical misplacement . . . . . . . . . . . . . . . . 3 Compatibility with the ‘crop’ package (better test of ‘memoir’). . . . . . . . . . . . . . . . . . . . 3

v1.0

General:  New  commands

\LenToUnit, \AtPageUpperLeft,
\AtPageCenter, \AtTextUpperLeft,
and \AtTextCenter. . . . . . . . . 1