• No results found

The obsolete everyshi package

N/A
N/A
Protected

Academic year: 2021

Share "The obsolete everyshi package"

Copied!
4
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

The obsolete everyshi package

Martin Schröder

2020/11/18

Why you should no longer use this package:

This packages provides hooks into \sshipout called \EveryShipout and \AtNextShipout analogous to \AtBeginDocument.

With the introduction of the LATEX hook management this package

be-came obsolete in 2020. Information on their usage can be found in the the corresponding documentation for lthooks[1] and ltshipout[2]. We only pro-vide this package to allow backwards compatibility. For current versions of LATEX it’s only mapping the hooks to the original everyshi macros. In case

you use an older LATEX format, everyshi will automatically fallback to its’

old implementation by loading everyshi-2001-05-15.

Contents

1 Introduction 2 2 Usage 2 3 Options 2 4 Required packages 2 5 The implementation 2

5.1 The original implementation by Martin Schröder . . . 3

5.2 Allocations . . . 3

5.3 The user-visible commands . . . 3

5.4 Inserting the hooks . . . 3

6 Acknowledgements 4

The version umber of this file is v4.00, last revised 2020/11/18.

The name everyshi is a tribute to the 8+3 file-naming convention of certain “operating systems”; strictly speaking it should be everyshipout.

maintained by Marei Peischl

(2)

1 INTRODUCTION 2

1 Introduction

This package provides the hooks \EveryShipout and \AtNextShipout whose ar-guments are executed after the output routine has constructed \box255, and before \shipout is called.

2 Usage

\EveryShipout{hcodei} declares hcodei that is saved internally and executed be-fore each \shipout.

Warning: The hcodei is saved globally; there is currently no way to remove it.

\AtNextShipout{hcodei} declares hcodei that is saved internally and executed

\AtNextShipout

just before only the next \shipout.

The hcodei is executed after \box255 has been constructed by the output rou-tine and can change \box255. \shipout is called after hcodei.

Repeated use of the commands is permitted: the code in the argument is stored (and executed) in the order of their declarations.

The argument of \AtNextShipout is executed after the argument of \EveryShipout.

3 Options

The package has no options.

4 Required packages

The package does not require any further packages.

References

[1] Frank Mittelbach. The ltshipout package. http://mirrors.ctan.org/ macros/latex/base/lthooks-doc.pdf

[2] Frank Mittelbach. The ltshipout package. http://mirrors.ctan.org/ macros/latex/base/ltshipout-doc.pdf

5 The implementation

1h∗packagei 2\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} 3\IfFormatAtLeastTF{2020/10/01}{}{\input{everyshi-2001-05-15.sty}} 4\IfFormatAtLeastTF{2020/10/01}{}{\endinput}

(3)

5 THE IMPLEMENTATION 3

5.1 The original implementation by Martin Schröder

To provide compatibility for older LATEX formats we wrap the original

implementation of everyshi version 3.00 into the fallback package everyshi-2001-05-15.

8h∗fallbacki

9\ProvidesPackage{everyshi-2001-05-15}

10 [2020/11/18 v4.00 EveryShipout Package (fallback mechanism)]

5.2 Allocations

First we allocate the hooks

\@EveryShipout@Hook The code to be executed before \shipout is stored in \@EveryShipout@Hook.

11\newcommand{\@EveryShipout@Hook}{}

\@EveryShipout@AtNextHook The code to be executed just before the normal \shipout and \@EveryShipout@EveryHook.

12\newcommand{\@EveryShipout@AtNextHook}{}

5.3 The user-visible commands

\EveryShipout

\AtNextShipout The commands are modeled after \AtBeginDocument.13\newcommand*{\EveryShipout}[1] 14 {\g@addto@macro\@EveryShipout@Hook{#1}}

15\newcommand*{\AtNextShipout}[1]

16 {\g@addto@macro\@EveryShipout@AtNextHook{#1}}

5.4 Inserting the hooks

We want to redefine \shipout so that first \box255 is constructed and after that we can do something and at last shipout the (possible modified) \box255. Alas, this does not work in the usual way, since \shipout is a TEX primitive whose argument is a hboxi. This means that simply redefining \shipout via

\newcommand[1] is impossible since hboxi can be something like \box255 or something like \vbox{…}. In the first case #1 would be h\boxi (without h255i); in the second case it would be h\vboxi (without h{…}i).

The solution we use here is borrowed from quire.tex by Marcel R. van der Goot. It is based upon \afterassignment and \aftergroup.

\@EveryShipout@Shipout \@EveryShipout@Shipout is our replacement for \shipout.

17\newcommand{\@EveryShipout@Shipout}{%

18 \afterassignment\@EveryShipout@Test 19 \global\setbox\@cclv= %

20 }

(4)

6 ACKNOWLEDGEMENTS 4

\@EveryShipout@Test \@EveryShipout@Test determines if \shipout is called with an argument like \box255 or something like \vbox{…}. In the later case we delay the call of \@EveryShipout@Output (where the original \shipout is called) via \aftergroup. 21\newcommand{\@EveryShipout@Test}{% 22 \ifvoid\@cclv\relax 23 \aftergroup\@EveryShipout@Output 24 \else 25 \@EveryShipout@Output 26 \fi% 27 }

\@EveryShipout@Output \@EveryShipout@Output does the actual work. First the hcodei accumulated via \EveryShipout and \AtNextShipout is called and then the original \shipout stored in \@EveryShipout@Org@Shipout is called to finally ship out \box255.

28\newcommand{\@EveryShipout@Output}{% 29 \@EveryShipout@Hook%

30 \@EveryShipout@AtNextHook%

We have to reset \@EveryShipout@AtNextHook after each use.

31 \gdef\@EveryShipout@AtNextHook{}% 32 \@EveryShipout@Org@Shipout\box\@cclv%

33 }

\@EveryShipout@Org@Shipout The original \shipout is stored in \@EveryShipout@Org@Shipout by \@EveryShipout@Init. Here we allocate it.

34\newcommand{\@EveryShipout@Org@Shipout}{}

\@EveryShipout@Init \@EveryShipout@Init stores the original \shipout in

\@EveryShipout@Org@Shipout and sets \shipout to \@EveryShipout@Shipout. This is done at \begin{document} via \AtBeginDocument.

35\newcommand*{\@EveryShipout@Init}{%

36 \message{ABD: EveryShipout initializing macros}% 37 \let\@EveryShipout@Org@Shipout\shipout 38 \let\shipout\@EveryShipout@Shipout 39 } 40\AtBeginDocument{\@EveryShipout@Init} 41h/fallbacki

6 Acknowledgements

Referenties

GERELATEERDE DOCUMENTEN

Macro writers may want to (re)define commands like the fixjfm version of \textmc and \textgt for CJK text fonts, thus the following command is

This package 1 provides a ‘Tabbing’ environment, analog to the L A TEX standard ‘tabbing’ environment, but allowing accented letters..

It uses the changepage package to check if the command is called on an even page, and the afterpage package to add material to a facing odd page if necessary. The changepage

This package provides means for retrieving properties of chemical el- ements like atomic number, element symbol, element name, electron distribution or isotope number.. Properties

The package EASYEQN introduces some equation environments that sim- plify the typesetting of equations.. It uses a syntax similar to the array envi- ronment to define the

The EASYMAT package is a macro package for supporting block matrices having equal column widths or equal rows heights or both, and supporting various kinds of rules (lines) between

The EASYTABLE package is a macro package for writing tables, with equal column widths or equal rows heights or both, with various kinds of rules (lines) between rows and columns..

In the first case, it creates the new command (macro) \cmd which executes \cmda when in scalar mode and \cmdb when in vector mode. In the second case it creates a new command \cmd