The draftcopy package^{∗}

Jürgen Vollmer University of Karlsruhe

email: vollmer@ipd.info.uni-karlruhe.de WWW: http://i44www.info.uni-karlsruhe.de/˜ vollmer

October 16, 1995, Version 2.3

Abstract

This package is used to print on some pages the word DRAFT (or the language dependend analogon) “behind” the intended stuff.

1 Introduction

Before releasing a document you may wish to give to others to proof read it. But it should be clear to the read that it is still a draft version of that document. To mark this so it could not be overseen, you can print the word DRAFT with big and light grey letters onto each page. This can be done with this package.

You can specify the intensity of the gray, the range of pages onto which the word DRAFT is printed. The word DRAFT is replaced according to the language you are using, e.g. in german you get ENTWURF. You may also specify any word to be used instead of DRAFT. From now on in this document DRAFT stands for that word.

Credits go the the Unkown, who started this as a L^{A}TEX style file containing only the central special Postscript command printing english word DRAFT on each page of the document.

2 User Interface

2.1 Options

Options for this package are: english,

∗This not a DRAFT version of this document. Its simply documentation and demonstration of the package in one document.

german ,… This package accepts the language options of the

babel package^{1}.

first  Prints DRAFT only on the first page.
firsttwo  Prints DRAFT only on the first two pages.
all  Prints DRAFT on all pages of the document.
light  The word DRAFT is printed with a light grey.
dark  The word DRAFT is printed with a dark grey.

The default options are: english,all,dark, wich corresponds to the behaviour of the old implementation of this package.

2.2 Commands

Additionally to the options, eachfeature may be set by commands, which must be placed in the preamble of the document.

\draftcopySetGrey • Set the intensity of the gray. The argument value range from 0.0 to 1.0, where the smaller values darker.

\draftcopyLastPage • The argument specifies the last page onto which DRAFT will be printed. This is the physical page number.

\draftcopyName • The first argument specifies the word to be printed instead of DRAFT, the second, gives the scale factor for the font to be used. E.g. the english word DRAFT needs 215, the german ENTWURF needs 155.

3 A few warnings

The result of printing DRAFT onto the page will be visible only in the Postscript output, not in the DVI output. The other text will be visible always. Sometimes ghostview has problems in presenting the correct result, use ghostscript (gs) instead. The printed result should always meet your intension.

4 The documentation driver file

The next bit of code contains the documentation driver file for TEX, i.e., the file that will produce the documentation you are currently reading. It will be extracted from this file by the docstrip program.

1 ⟨∗driver⟩

 2 \documentclass[a4paper]{article}
 3 \usepackage{doc}
 4 \usepackage[light,first]{draftcopy}
 5 \CodelineIndex

6

 7 \begin{document}
 8 \DocInput{draftcopy.doc}
 9 \end{document}

10 ⟨/driver⟩

1Currently not all languages are supported, I still need volunteers to send me trranslation of the word DRAFT into the other languages L^{A}TEX2e with its babel package supports.

5 The implementation

The implementation is based on manipulating the Postscript output, using the special command.

What do we need, and who we are:

11 ⟨∗package⟩

12 \NeedsTeXFormat{LaTeX2e}
13 \ProvidesPackage{draftcopy}[1995/10/16 v2.3]

Here we define the options for setting the intensity of the gray. Smaller values mean darker.

14 \DeclareOption{light}{
15 \special{!userdict begin /draftcopy-GrayValue 0.90 def end}

16 }

17 \DeclareOption{dark}{
18 \special{!userdict begin /draftcopy-GrayValue 0.85 def end}

19 }

Here we define the options, which specify the range of pages where DRAFT will be printed. We use the Postcript variable draftcopy-LastPage to store the number.

20 \DeclareOption{first}{
21 \special{!userdict begin /draftcopy-LastPage 1 def end}

22 }

23 \DeclareOption{firsttwo}{
24 \special{!userdict begin /draftcopy-LastPage 2 def end}

25 }

26 \DeclareOption{all}{
27 \special{!userdict begin /draftcopy-LastPage 99999 def end}

28 }

Define the word DRAFT and its scaling, in case no language option is given.

29 \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215 }

The babel language options are honored, even currently not all of them have a translation for the word DRAFT. The Postscript variable draftcopy@Name holds the word for DRAFT of that language and draftcopy@Scale is a font scale factor, it must be determined empirically. Note the blank follow the number is significant.

30 \DeclareOption{american}{
31 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

32 }

33 \DeclareOption{austrian}{
34 ␣␣\def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155␣}

35 }

36 \DeclareOption{bahasa}{
37 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

38 }

39 \DeclareOption{brazil}{
40 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

41 }

42 \DeclareOption{brazilian}{
43 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

44 }

45 \DeclareOption{breton}{

46 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

47 }

48 \DeclareOption{british}{
49 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

50 }

51 \DeclareOption{catalan}{
52 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

53 }

54 \DeclareOption{croatian}{
55 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

56 }

57 \DeclareOption{czech}{
58 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

59 }

60 \DeclareOption{danish}{
61 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

62 }

63 \DeclareOption{dutch}{
64 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

65 }

66 \DeclareOption{english}{
67 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

68 }

69 \DeclareOption{esperanto}{
70 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

71 }

72 \DeclareOption{estonian}{
73 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

74 }

75 \DeclareOption{finnish}{
76 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

77 }

78 \DeclareOption{francais}{
79 ␣␣\def\draftcopy@Name{BROUILLON}\def\draftcopy@Scale{120␣}

80 }

81 \DeclareOption{french}{
82 ␣␣\def\draftcopy@Name{BROUILLON}\def\draftcopy@Scale{120␣}

83 }

84 \DeclareOption{galician}{
85 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

86 }

87 \DeclareOption{german}{
88 ␣␣\def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155␣}

89 }

90 \DeclareOption{germanb}{
91 ␣␣\def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155␣}

92 }

93 \DeclareOption{hungarian}{
94 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

95 }

96 \DeclareOption{irish}{
97 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

98 }

99 \DeclareOption{italian}{

100 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

101 }

102 \DeclareOption{lowersorbian}{
103 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

104 }

105 \DeclareOption{magyar}{
106 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

107 }

108 \DeclareOption{norsk}{
109 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

110 }

111 \DeclareOption{nynorsk}{
112 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

113 }

114 \DeclareOption{polish}{
115 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

116 }

117 \DeclareOption{portuges}{
118 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

119 }

120 \DeclareOption{portuguese}{
121 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

122 }

123 \DeclareOption{romanian}{
124 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

125 }

126 \DeclareOption{scottish}{
127 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

128 }

129 \DeclareOption{spanish}{
130 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

131 }

132 \DeclareOption{slovak}{
133 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

134 }

135 \DeclareOption{slovene}{
136 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

137 }

138 \DeclareOption{swedish}{
139 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

140 }

141 \DeclareOption{turkish}{
142 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

143 }

144 \DeclareOption{uppersorbian}{
145 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

146 }

Use these default options,

147 \ExecuteOptions{dark,first,english}

and the process the user options.

148 \ProcessOptions

Tell the user what’s ongoing.

149 \typeout{Prints "DRAFT" on pages; does not show in TeXView}

\draftcopySetGrey Set the intensity of the gray, values range from 0.0 to 1.0, where the smaller values darker.

150 \newcommand{\draftcopySetGrey}[1]{
151 \special{!userdict begin /draftcopy-GrayValue #1 def end}

152 }

\draftcopyLastPage The argument specifies the last page onto which DRAFT will be printed. This is the physical page number.

153 \newcommand{\draftcopyLastPage}[1]{
154 \special{!userdict begin /draftcopy-LastPage #1 def end}

155 }

\draftcopyName The first argument specifies the word to be printed instead of DRAFT, the second, gives the scale factor for the font to be used. E.g. the english word DRAFT needs 215, the german ENTWURF needs 155. Note we need the blank after the #2.

156 \newcommand{\draftcopyName}[2]{
157 ␣␣\def\draftcopy@Name{#1}
158 ␣␣\def\draftcopy@Scale{#2␣}

159 }

Here we introduce some Postscript code. The dictionary userdict is extended with the page counter draftcopy-CurrentPage. Each time a new page starts bop-hook is called (if it’s defined). Hence we define it. First we increment the current page counter. If then the current page counter is smaller than the last page counter draftcopy-LastPage we print the word contained in the L^{A}TEXmacro draftcopy@Name with the font scaled with L^{A}TEXmacro

draftcopy@Scale.

This must be done at the beginning of the document \AtBeginDocument, so that the preamble commands take effect.

160 \AtBeginDocument{
161 \special{
162 !userdict begin
163 /draftcopy-CurrentPage 0 def
164 /bop-hook{
165  /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
166  draftcopy-CurrentPage draftcopy-LastPage le
167  { gsave 200 70 translate 65 rotate
168  /Times-Roman findfont
169  \draftcopy@Scale scalefont setfont
170  0 0 moveto
171  draftcopy-GrayValue setgray
172  (\draftcopy@Name) show
173  grestore
174  } if
175 } def
176 end

177 } 178 } 179 ⟨/package⟩