The prelim2e package^{∗}

Martin Schröder

Crüsemannallee 3 28213 Bremen Germany martin@oneiros.de

                           PGP-Key:  2048 bit / KeyID 292814E5
                        7E86 6EC8 97FA 2995  82C3 FEA5 2719 090E

2001/02/17

Abstract

This package allows the marking of (preliminary) versions of a document on the output.

Contents

1 Introduction 1

2 Usage 2

3 Options 2

4 Required packages 3

5 Putting more things at the bottom 3

6 The implementation 3 6.1 Initial Code . . . . . . 3 6.2 Declaration of options 3 6.2.1 draft option . . 3 6.2.2 Language op-

tions . . . . . . 3 6.2.3 Time options . 4 6.2.4 Other options . 4 6.3 Executing options . . 4 6.4 Loading packages … 4 6.5 Producing the text . . 4 6.6 Putting the text be-

low the page . . . . . . 5 6.7 Tieing prelim2e into

the system . . . . . . . 6

7 Acknowledgements 6

1 Introduction

This package allows the marking of (preliminary) versions of a document. This is done using the command \PrelimText, whose expansion is added below the footer of every page of a document (look at the bottom of this page for an example).

1

∗The version number of this file is v1.23, last revised 2001/02/17.

prelim2e package – Version v1.23 – Documentation L^{A}TEXed – February 17, 2001 – 16:17

2 Usage

Simply using this package via \usepackage{prelim2e} produces a text in the form of “Preliminary version – February 17, 2001”.

\PrelimText  The text is produced by the commands \PrelimText and \PrelimWords,

\PrelimWords which can be changed via \renewcommand or by using options at the

\usepackage command (see section 3).

The footer for this documentation was produced by changing \PrelimWords to

     \renewcommand{\PrelimWords}{%
        \textsf{prelim2e} package --
        Version \fileversion{} --
        Documentation \LaTeX{}ed%
        }

3 Options

The package has the following options:

danish This sets the text to “Foreløbig version”. It does not use the babel

New feature 2001/02/17

package.

draft If this option is used a text appears below the normal pagebody. It is the default.

final If this option is used prelim2e produces no text.

english This sets the text to “Preliminary version”. It is the default.

french This sets the text to “Version préliminaire”. It does not use the

New feature 1997/05/12

french or babel package.

german This sets the text to “Vorläufige Version”. It does not use the german or babel package.

italian This sets the text to “Versione preliminare”. It does not use the

New feature 2001/02/17

babel package.

New description time This adds the time at the beginning of the current L^{A}TEX to the text. 1997/05/12 The time is produced using the \thistime command, which may

be provided by the scrtime package[2]. If you don’t use the scrtime package (e. g. by specifying the scrtime option), you must provide it yourself or by some other package.

scrtime This loads the scrtime package[2] (part of the KOMA-Script bun-

New feature 1997/05/12

dle), which provides the \thistime command used by the time option. The scrtime option implies the time option.

All other options are passed to the scrtime package if the scrtime option is selected.

4 Required packages

The package requires the following packages:

everyshi[3] It is used to implement the setting of the text below the normal pagebody.

New description scrtime[2] It is used to typeset the current time and is needed if the scrtime 1997/05/12 option is selected.

5 Putting more things at the bottom

Another package you might like to use with prelim2e is vrsion[4]. This allows the definition and maintenance of a version number like 3.14159 within L^{A}TEX, which can be put at the bottom of every page using prelime2e.

6 The implementation

1 ⟨∗package⟩

6.1 Initial Code

\if@prelim@draft \if@prelim@draft is used to flag the use of the draft or final option.

 2 \newif\if@prelim@draft

\if@prelim@time \if@prelim@time is used to flag the use of the time option.

 3 \newif\if@prelim@time
\if@prelim@scrtime  \if@prelim@scrtime is used to flag the use of the scrtime option.
 4 \newif\if@prelim@scrtime

\PrelimWords \PrelimWords holds the language-dependend text used in \PrelimText

 5 \newcommand{\PrelimWords}{}

6.2 Declaration of options

6.2.1 draft option

The draft and final option control the behavior of prelim2e: Only if final is used in \documentclass or \usepackage{prelim2e} text is produced.

 6 \DeclareOption{draft}{\@prelim@drafttrue}
 7 \DeclareOption{final}{\@prelim@draftfalse}

6.2.2 Language options

danish, english, french, german and italian control the content of \PrelimWords.

 8 \DeclareOption{danish}{%
 9 \renewcommand{\PrelimWords}{Forel\o{}big version}}
10 \DeclareOption{english}{%
11 \renewcommand{\PrelimWords}{Preliminary version}}
12 \DeclareOption{french}{%

6 THE IMPLEMENTATION 4

13 \renewcommand{\PrelimWords}{Version pr\'eliminaire}}
14 \DeclareOption{german}{%
15 \renewcommand{\PrelimWords}{Vorl\"aufige Version}}
16 \DeclareOption{italian}{%
17 \renewcommand{\PrelimWords}{Versione preliminare}}

6.2.3 Time options

time controls the output of the current time at \PrelimWords.

18 \DeclareOption{time}{\@prelim@timetrue}

scrtime controls the loading of the scrtime package. It implies time.

19 \DeclareOption{scrtime}{\@prelim@scrtimetrue\@prelim@timetrue}

6.2.4 Other options

All unused options are passed to the scrtime package if the scrtime option is selected.

20 \DeclareOption*{%
21 \if@prelim@scrtime
22  \PassOptionsToPackage{\CurrentOption}{scrtime}%
23 \fi

24 }

6.3 Executing options

The default options are draft and english.

25 \ExecuteOptions{draft,english}
26 \ProcessOptions\relax

6.4 Loading packages

We need the everyshi package—and scrtime, if the scrtime option is specified.

27 \RequirePackage{everyshi}[1995/01/25]
28 \if@prelim@scrtime
29 \RequirePackage{scrtime}
30 \fi

6.5 Producing the text

\PrelimText \PrelimText produces the text which is put below the page. It can be changed via \renewcommand. The style of the text is controlled by \PrelimTextStyle. We first have to reset the style and size, otherwise the settings in effect at the point of text where \ouput is called would be used.

31 \newcommand{\PrelimText}{%
32 \textnormal{%
33  \footnotesize%
34  \PrelimTextStyle%
35  \PrelimWords{} -- \today
36  \if@prelim@time
37  \ -- \thistime

38  \fi
39  }%

40 }

\PrelimTextStyle  \PrelimTextStyle controls the style of the text produced by \PrelimText.

It’s default is empty.

41 \newcommand{\PrelimTextStyle}{}

6.6 Putting the text below the page

We put the text below the page via \EveryShipout provided by the everyshi

package. This is done by \@Prelim@EveryShipout.
\@Prelim@EveryShipout  \@Prelim@EveryShipout puts the text produced by \PrelimText below

the page. To do this we modify \box255: We append a \vbox with height and depth of 0pt and the width of \box255 which contains a \hbox with the width of \box255 in which \PrelimText is centered.

42 \newcommand{\@Prelim@EveryShipout}{
43 \bgroup

First we save the dimensions of \box255: height, width and depth; and calculate the total height of \box255.

44  \dimen\z@=\wd\@cclv
45  \dimen\@ne=\ht\@cclv
46  \dimen\tw@=\dp\@cclv
47  \dimen\thr@@=\dimen1
48  \advance\dimen\thr@@ by \dimen\tw@

Then we set \box255: A \vbox to the total height of \box255. In this a \hbox to the width of \box255 is included, in which \box255 is set.

49  \global\setbox\@cclv\vbox to \dimen\thr@@{%
50  \hb@xt@\dimen\z@{%
51  \box\@cclv%
52  \hss%
53  }%

To this we append the text produced by \PrelimText. It is put in a \vbox to 0pt in which a \hbox to the width of \box255 is included, in which \PrelimText is set. We have to reset \protect because it is set to \noexpand by the output routine.

54  \vbox to \z@{%
55  \hb@xt@\dimen\z@{%
56  \let\protect\relax
57  \hfill\PrelimText\hfill%
58  }%
59  \vss%
60  }%
61  \vss%
62  }%

Finally we set the dimensions of \box255 to the values they had before

\@Prelim@EveryShipout.
63  \wd\@cclv=\dimen\z@
64  \ht\@cclv=\dimen\@ne

65  \dp\@cclv=\dimen\tw@
66 \egroup

67 }

6.7 Tieing prelim2e into the system

\@Prelim@EveryShipout is tied into the system via \EveryShipout. But

only if the draft option is used.

68 \if@prelim@draft
69 \EveryShipout{\@Prelim@EveryShipout}
70 \fi

71 ⟨/package⟩

7 Acknowledgements

The idea of this package is based on prelim.sty[1] for L^{A}TEX2.09 by Robert Tolksdorf (tolk@cs.tu-berlin.de). It provides nearly the same functionality as prelim2e, but in a very dirty way: it uses a modified output routine and does not work with L^{A}TEX 2ε.

The time functionality now uses the scrtime package by Markus Kohm

(markus.kohm@gmx.de).
   Rowland Bartlett (R.BARTLETT@liverpool-john-moores.ac.uk) brought

forth the idea of separating the time option and the scrtime package;

Daniel Courjon (dcourjon@utinam.univ-fcomte.fr) provided the text

for the french option, Arne Jørgensen (arne.jorgensen@tug.dk) provided the text for the danish option, and Davide Giovanni Maria Salvetti

(salve@debian.org) and Riccardo Murri (murri@phc.unipi.it) both pro-

vided the text for the italian option, As usual Rebecca Stiels improved the quality of this documentation.

References

[1] Mats Dahlgren. vrsion – a L^{A}TEX Macro for version Numbering of Files.

   CTAN:tex-archive/macros/latex/contrib/supported/vrsion/

vrsion.dtx. L^{A}TEX 2ε package.

[2] Markus Kohm. The KOMA-timedate-bundle. CTAN:tex-archive/

   macros/latex/contrib/supported/koma-script/scrtime.dtx.

L^{A}TEX 2ε package.

[3] Martin Schröder. The everyshi package. CTAN:

   tex-archive/macros/latex/contrib/supported/ms/everyshi.dtx.

L^{A}TEX 2ε package.

[4] Robert Tolksdorf. Kennzeichnung von Vorversionen eines Dokuments.

   CTAN:tex-archive/macros/latex209/contrib/prelim/. L^{A}TEX2.09

package.

Index 7

Index

Numbers written in italic refer to the page where the corresponding entry is described; numbers underlined refer to the code line of the definition; numbers in roman refer to the code lines where the entry is used.

Symbols

\" . . . . . . . . . . . . . . . . . . . . . . . 15 \' . . . . . . . . . . . . . . . . . . . . . . . 13

\@Prelim@EveryShipout . . . . \underline{42}, 69

\@cclv . . . . . . . 44–46, 49, 51, 63–65 \@ne . . . . . . . . . . . . . . . . . . . 45, 64

\@prelim@draftfalse . . . . . . . . . . 7
\@prelim@drafttrue . . . . . . . . . . . 6
\@prelim@scrtimetrue . . . . . . . . 19
\@prelim@timetrue . . . . . . . 18, 19

\␣ . . . . . . . . . . . . . . . . . . . . . . . 37

A

\advance . . . . . . . . . . . . . . . . . . 48

B

\bgroup . . . . . . . . . . . . . . . . . . . 43 \box . . . . . . . . . . . . . . . . . . . . . . 51

C

\CurrentOption . . . . . . . . . . . . . 22

D

\DeclareOption . . . . . . . . . . . .

…. 6–8, 10, 12, 14, 16, 18–20 \dimen . . . . . . . . . 44–50, 55, 63–65 \dp . . . . . . . . . . . . . . . . . . . 46, 65

E

\egroup . . . . . . . . . . . . . . . . . . . 66 \EveryShipout . . . . . . . . . . . . . . 69

\ExecuteOptions . . . . . . . . . . . . 25

F

\fi . . . . . . . . . . . . . . 23, 30, 38, 70 \footnotesize . . . . . . . . . . . . . . 33

G

\global . . . . . . . . . . . . . . . . . . . 49

H

\hb@xt@ . . . . . . . . . . . . . . . . 50, 55 \hfill . . . . . . . . . . . . . . . . . . . . 57 \hss . . . . . . . . . . . . . . . . . . . . . . 52 \ht . . . . . . . . . . . . . . . . . . . 45, 64

I

                                    \if@prelim@draft . . . . . . . . . \underline{2}, 68
                                    \if@prelim@scrtime . . . . . \underline{4}, 21, 28
                                    \if@prelim@time . . . . . . . . . . \underline{3}, 36

L \let . . . . . . . . . . . . . . . . . . . . . . 56

N \newcommand . . . . . . . . . 5, 31, 41, 42 \newif . . . . . . . . . . . . . . . . . . . 2–4

O \o . . . . . . . . . . . . . . . . . . . . . . . . 9

P

                                    \PassOptionsToPackage . . . . . . . 22

\PrelimText . . . . . . . . . . . 2, \underline{31}, 57

                                    \PrelimTextStyle . . . . . . . . 34, \underline{41}

\PrelimWords . . . . . . . . . . . . . .

…. 2, \underline{5}, 9, 11, 13, 15, 17, 35

                                    \ProcessOptions . . . . . . . . . . . . 26

\protect . . . . . . . . . . . . . . . . . . 56

R \relax . . . . . . . . . . . . . . . . . 26, 56 \renewcommand …. 9, 11, 13, 15, 17

                                    \RequirePackage . . . . . . . . . 27, 29

S \setbox . . . . . . . . . . . . . . . . . . . 49

T \textnormal . . . . . . . . . . . . . . . . 32 \thistime . . . . . . . . . . . . . . . . . 37 \thr@@ . . . . . . . . . . . . . . . . . 47–49 \today . . . . . . . . . . . . . . . . . . . . 35 \tw@ . . . . . . . . . . . . . . . . 46, 48, 65

V \vbox . . . . . . . . . . . . . . . . . . 49, 54 \vss . . . . . . . . . . . . . . . . . . . 59, 61

W \wd . . . . . . . . . . . . . . . . . . . 44, 63

Z \z@ . . . . . . . . . . . 44, 50, 54, 55, 63

Change History 8

Change History

v1.00

General: New . . . . . . . . . . . . . 1 v1.01

General: Date added to

   \NeedsTeXFormat . . . . . . . 1

v1.10

\@Prelim@EveryShipout: \hbox

to→\hb@xt@ . . . . . . . . . . . 5

General:  \DeclareOption*

added . . . . . . . . . . . . . . . . 4 scrtime instead of printtim … 3 time option added . . . . . . 2, 4

\if@prelim@time: new . . . . . . . 3
\PrelimText: \thistime in-

stead of \PrintTime . . . . . 4 v1.20

General: french option added 2, 3 scrtime option added …. 2, 4

                                      check \if@prelim@scrtime . . 4
                                    \if@prelim@scrtime: new . . . . 3

v1.21

General: Documentation im-

proved . . . . . . . . . . . . . . . 1 v1.22

General: Moved to LPPL . . . . . 1 v1.23

General: danish option added 2, 3 italian option added . . . . . 2, 3