The draftcopy package^{∗}

Jürgen Vollmer University of Karlsruhe

email: Juergen.Vollmer@informatik.uni-karlsruhe.de WWW: http://i44www.info.uni-karlsruhe.de/˜ vollmer

May 20, 1996, Version 2.8

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 it to others to proof read it. But it should be clear to the reader 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 some pages. 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 and where it is printed (across the page or at the bottom). 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. Credits also to those, who send me translations of the word DRAFT and bug-reports and bug-fixes as well ideas for more functionality (see in the sources).

For italian, dutch and finnish two proposals exists. Have a look and change it (in the file draftcopy.sty, or by using \draftcopyName) according to your mind.

2 User Interface

2.1 Options

Options for this package are: english, german, … This package accepts the language options of the babel

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

package^{1}. The babel package is not loaded by draftcopy.

none Don’t print DRAFT across of any page.

first Prints DRAFT across only on the first page.

firsttwo Prints DRAFT across only on the first two pages.

all Prints DRAFT across on all pages of the document.

bottom Prints DRAFT on all pages at the bottom of the page.

bottomafter Prints DRAFT at the bottom of the pages following the

pages which have DRAFT across them.

light The word DRAFT is printed with a light grey.

dark The word DRAFT is printed with a dark grey.

dvips,

textures, … This package accepts the options of the graphics package^{2}. The graphics package is not loaded by draftcopy.

The default options are: dvips,english,all,dark, which corresponds to the behaviour of the old implementation of this package. If the configuration file graphics.cfg (from the graphics package) is present, the driver specified there is used. This specification is overruled, if the driver option is given explicitly.

\underline{Note for textures “users”:} It seems that a wrong graphics.cfg file is distributed with the textures package. It contains a declaration of the textures option which should not be there. If your graphics.cfg contains a line

\DeclareOption{textures}{\def\Gin@driver{textures.def}}

then remove this line. If there is a line

\DeclareOption{textures}{\def\Gin@driver{textures-1.7.def}}

then rename textures-1.7.def to textures.def (or any other revision number) and remove the line.

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.

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.

2Currently only dvips, dvipsone and textures are supported. All others are mapped to dvips. If you are using another driver, let me know what to.

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,bottomafter]{draftcopy}
 5 \CodelineIndex

6

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

10 ⟨/driver⟩

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}[1996/05/20 v2.8]

Declaration of various graphic driver options. Different DVI driver use different names :-(

14 \DeclareOption{dvips}{
15 \def\draftcopy@BOPhook{/bop-hook}
16 \def\draftcopy@UserDictCmd{! userdict }

17 }

18 \DeclareOption{dvipsone}{
19 % thanks to V. P. Stokes <virgil.stokes@neuro.ki.se>
20 \def\draftcopy@BOPhook{/bphook}
21 \def\draftcopy@UserDictCmd{! userdict }

22 }

23 \DeclareOption{textures}{
24 % thanks to Jerome LAURENS <laurens@u-bourgogne.fr>
25 \def\draftcopy@BOPhook{/bop-hook}
26 \def\draftcopy@UserDictCmd{prepostscript userdict }

27 }

28

29 % For the following |dvips| will be used. I don't know it better.
30 \DeclareOption{xdvi}{\ExecuteOptions{dvips}}

31 \DeclareOption{dvi2ps}{\ExecuteOptions{dvips}}
32 \DeclareOption{dvialw}{\ExecuteOptions{dvips}}
33 \DeclareOption{dvilaser}{\ExecuteOptions{dvips}}
34 \DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}}
35 \DeclareOption{dvitops}{\ExecuteOptions{dvips}}
36 \DeclareOption{emtex}{\ExecuteOptions{dvips}}
37 \DeclareOption{dviwin}{\ExecuteOptions{dvips}}
38 \DeclareOption{oztex}{\ExecuteOptions{dvips}}
39 \DeclareOption{psprint}{\ExecuteOptions{dvips}}
40 \DeclareOption{pubps}{\ExecuteOptions{dvips}}
41 \DeclareOption{pctexps}{\ExecuteOptions{dvips}}
42 \DeclareOption{pctexwin}{\ExecuteOptions{dvips}}
43 \DeclareOption{pctexhp}{\ExecuteOptions{dvips}}
44 \DeclareOption{ln}{\ExecuteOptions{dvips}}

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

45 \DeclareOption{light}{
46  \def\draftcopy@GrayValue{0.90 }

47 }

48

49 \DeclareOption{dark}{
50  \def\draftcopy@GrayValue{0.85 }

51 }

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

52 \DeclareOption{none}{
53 \def\draftcopy@LastPage{0 }

54 }

55 \DeclareOption{first}{
56 \def\draftcopy@LastPage{1 }

57 }

58 \DeclareOption{firsttwo}{
59 \def\draftcopy@LastPage{2 }

60 }

61 \DeclareOption{all}{
62 \def\draftcopy@LastPage{99999 }

63 }

The option to print DRAFT at the bottom of all pages. The idea for the bottom options and the corresponding PostScript code is from Paolo Ienne

Paolo.Ienne@di.epfl.ch.
64 \newif\ifdraftcopy@bottom
65 \DeclareOption{bottom}{
66 \draftcopy@bottomtrue

67 }

The option to print DRAFT at the bottom of the page, after the initial pages containing DRAFT printed across of a page.

68 \newif\ifdraftcopy@bottomAfter
69 \DeclareOption{bottomafter}{
70 \draftcopy@bottomAftertrue

71 }

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

72 \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.

73 \DeclareOption{american}{
74 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

75 }

76 \DeclareOption{austrian}{
77 ␣␣\def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155␣}

78 }

79 \DeclareOption{bahasa}{
80 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

81 }

82 \DeclareOption{brazil}{
83 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

84 }

85 \DeclareOption{brazilian}{
86 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

87 }

88 \DeclareOption{breton}{
89 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

90 }

91 \DeclareOption{british}{
92 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

93 }

94 \DeclareOption{catalan}{
95 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

96 }

97 \DeclareOption{croatian}{
98 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

99 }

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

102 }

103 \DeclareOption{danish}{
104 ␣␣%␣thanks␣to␣ezr@md-oss.dk␣(Ejnar␣Zacho␣Rath)␣,
105 ␣␣%␣thanks␣to␣Bjarne␣Vestergaard␣<bvbruder@dfi.aau.dk>
106 ␣␣%␣thanks␣to␣Joergen␣Larsen␣<JL@mmf.ruc.dk>
107 ␣␣\def\draftcopy@Name{UDKAST}\def\draftcopy@Scale{175␣}

108 }

109 \DeclareOption{dutch}{
110 ␣␣%␣thanks␣to␣Kees␣Leune␣<C.J.Leune@kub.nl>
111 ␣␣%␣\def\draftcopy@Name{CONCEPT}\def\draftcopy@Scale{150␣}
112 ␣␣%␣thanks␣to␣Anton␣Stoorvogel␣<wscoas@as.win.tue.nl>␣porposed
113 ␣␣\def\draftcopy@Name{ONTWERP}\def\draftcopy@Scale{150␣}

114 }

115 \DeclareOption{english}{
116 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

117 }

118 \DeclareOption{esperanto}{

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

120 }

121 \DeclareOption{estonian}{
122 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

123 }

124 \DeclareOption{finnish}{
125 ␣␣%␣thanks␣to␣Jaakko␣Ruohio␣<jjruohio@boojum.hut.fi>
126 ␣␣\def\draftcopy@Name{LUONNOS}\def\draftcopy@Scale{200␣}
127 ␣␣%␣thanks␣to␣Mika␣Grundstroem␣<mikagr@spittari.cs.tut.fi>
128 ␣␣\def\draftcopy@Name{VEDOS}\def\draftcopy@Scale{250␣}

129 }

130 \DeclareOption{francais}{
131 ␣␣%␣thanks␣to␣Christophe␣Couvreur␣<couvreur@Thor.fpms.ac.be>
132 ␣␣\def\draftcopy@Name{BROUILLON}\def\draftcopy@Scale{120␣}

133 }

134 \DeclareOption{french}{
135 ␣␣%␣thanks␣to␣Christophe␣Couvreur␣<couvreur@Thor.fpms.ac.be>
136 ␣␣\def\draftcopy@Name{BROUILLON}\def\draftcopy@Scale{120␣}

137 }

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

140 }

141 \DeclareOption{german}{
142 ␣␣\def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155␣}

143 }

144 \DeclareOption{germanb}{
145 ␣␣\def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155␣}

146 }

147 \DeclareOption{hungarian}{
148 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

149 }

150 \DeclareOption{irish}{
151 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

152 }

153 \DeclareOption{italian}{
154 ␣␣%␣thanks␣to␣Fabio␣Massacci␣<Fabio.Massacci@cl.cam.ac.uk>
155 ␣␣%␣thanks␣to␣Paolo␣Dell'Aquila␣<dlle07k1@mo.nettuno.it>
156 ␣␣\def\draftcopy@Name{BOZZA}\def\draftcopy@Scale{215␣}
157 ␣␣%␣thanks␣to␣Giuseppe␣De␣Arcangelis␣<gdearc@serifos.caspur.it>}
158 ␣␣%␣\def\draftcopy@Name{brutta␣copia}\def\draftcopy@Scale{80␣}

159 }

160 \DeclareOption{lowersorbian}{
161 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

162 }

163 \DeclareOption{magyar}{
164 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

165 }

166 \DeclareOption{norsk}{
167 ␣␣%␣thanks␣to:␣Dag␣Langmyhr␣<dag@ifi.uio.no>
168 ␣␣\def\draftcopy@Name{UTKAST}\def\draftcopy@Scale{178␣}

169 }

170 \DeclareOption{nynorsk}{
171 ␣␣%␣thanks␣to:␣Dag␣Langmyhr␣<dag@ifi.uio.no>
172 ␣␣\def\draftcopy@Name{FRAMLEGG}\def\draftcopy@Scale{129␣}

174 \DeclareOption{polish}{
175 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

176 }

177 \DeclareOption{portuges}{
178 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

179 }

180 \DeclareOption{portuguese}{
181 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

182 }

183 \DeclareOption{romanian}{
184 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

185 }

186 \DeclareOption{scottish}{
187 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

188 }

189 \DeclareOption{spanish}{
190 ␣␣%␣thanks␣to:␣Tomas␣Bautista␣<bautista@cma.ulpgc.es>
191 ␣␣\def\draftcopy@Name{BORRADOR}\def\draftcopy@Scale{120␣}

192 }

193 \DeclareOption{slovak}{
194 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

195 }

196 \DeclareOption{slovene}{
197 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

198 }

199 \DeclareOption{swedish}{
200 ␣␣%␣thanks␣to␣matsd@physchem.kth.se
201 ␣␣\def\draftcopy@Name{UTKAST}\def\draftcopy@Scale{185␣}

202 }

203 \DeclareOption{turkish}{
204 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

205 }

206 \DeclareOption{uppersorbian}{
207 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215␣}

208 }

Use these default options,

209 \ExecuteOptions{dvips,dark,all,english}

instead of dvips use the graphics driver specified by the graphics driver,

210 \InputIfFileExists{graphics.cfg}{}{}

and the process the user options.

211 \ProcessOptions

Tell the user what’s ongoing.

212 \typeout{Prints \draftcopy@Name\space on pages;
213 does not show in your DVI viewer}

\draftcopySetGrey Set the intensity of the gray, values range from 0.0 to 1.0, where the smaller values darker. If used, it must be conatined in the preamble of the document.

214 \newcommand{\draftcopySetGrey}[1]{
215 \def\draftcopy@GrayValue{#1 }

216 }

\draftcopyLastPage The argument specifies the last page onto which DRAFT will be printed. This is the physical page number. If used, it must be conatined in the preamble of the document.

217 \newcommand{\draftcopyLastPage}[1]{
218 \def\draftcopy@LastPage{#1 }

219 }

\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. If used, it must be conatined in the preamble of the document.

220 \newcommand{\draftcopyName}[2]{
221 ␣␣\def\draftcopy@Name{#1}
222 ␣␣\def\draftcopy@Scale{#2␣}

223 }

Here we introduce some Postscript code. The dictionary userdict is extended with the page counter draftcopy-CurrentPage. Each time a new page starts \draftcopy@BOPhook 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.

224 \ifdraftcopy@bottomAfter
225 \AtBeginDocument{
226  \special{
227  \draftcopy@UserDictCmd begin
228  /draftcopy-CurrentPage 0 def
229  \draftcopy@BOPhook{
230  /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
231  draftcopy-CurrentPage \draftcopy@LastPage le
232  { gsave 200 70 translate 65 rotate
233  /Times-Roman findfont
234  \draftcopy@Scale scalefont setfont
235  0 0 moveto
236  \draftcopy@GrayValue setgray
237  (\draftcopy@Name) show
238  grestore

239 }

240  { gsave 0 25 translate
241  /Times-Roman findfont
242  25 scalefont setfont
243  0 0 moveto
244  \draftcopy@GrayValue setgray
245  (\draftcopy@Name\ )
246  0 1 15 { pop dup show } for
247  grestore
248  } ifelse
249  } def
250  end

252 }

253 \else\ifdraftcopy@bottom
254 \AtBeginDocument{
255  \special{
256  \draftcopy@UserDictCmd begin
257  /draftcopy-CurrentPage 0 def
258  \draftcopy@BOPhook{
259  /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
260  draftcopy-CurrentPage \draftcopy@LastPage le
261  { gsave 200 70 translate 65 rotate
262  /Times-Roman findfont
263  \draftcopy@Scale scalefont setfont
264  0 0 moveto
265  \draftcopy@GrayValue setgray
266  (\draftcopy@Name) show
267  grestore
268  }if
269  gsave 0 25 translate
270  /Times-Roman findfont
271  25 scalefont setfont
272  0 0 moveto
273  \draftcopy@GrayValue setgray
274  (\draftcopy@Name\ )
275  0 1 15 { pop dup show } for
276  grestore
277  } def
278  end

279 } 280 }

281 \else
282 \AtBeginDocument{
283  \special{
284  \draftcopy@UserDictCmd begin
285  /draftcopy-CurrentPage 0 def
286  \draftcopy@BOPhook{
287  /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
288  draftcopy-CurrentPage \draftcopy@LastPage le
289  { gsave 200 70 translate 65 rotate
290  /Times-Roman findfont
291  \draftcopy@Scale scalefont setfont
292  0 0 moveto
293  \draftcopy@GrayValue setgray
294  (\draftcopy@Name) show
295  grestore
296  } if
297  } def
298  end

299 } 300 }

301 \fi\fi

302 ⟨/package⟩

6 Some Test Input Files

The next bit of code contains the some L^{A}TEX input files with various options set. They will be extracted from this file by the docstrip program, using the

 test1, ...  test7 option.

303 ⟨∗test1⟩

304 \documentclass[a4paper]{article}
305 \usepackage{draftcopy}
306 \newcommand{\xx}{
307 Test 1\\This is a test page \thepage \vfill
308 This is a testpage \thepage \newpage

309 }

310 \begin{document}
311 Should print DRAFT over all pages, quite dark.\\
312 \verb|\usepackage{draftcopy}|\\
313 \xx\xx\xx\xx
314 \end{document}

315 ⟨/test1⟩

316 ⟨∗test2⟩

317 \documentclass[a4paper,german]{article}
318 \usepackage[light,first]{draftcopy}
319 \newcommand{\xx}{
320 Test2: Should print ENTWURF on the first page, light.\\
321 This is a test page \thepage \vfill
322 This is a testpage \thepage \newpage

323 }

324 \begin{document}
325 \verb|\usepackage[light,first]{draftcopy}|\\
326 \xx\xx\xx\xx
327 \end{document}

328 ⟨/test2⟩

329 ⟨∗test3⟩

330 \documentclass[a4paper,french]{article}
331 \usepackage[light,firsttwo]{draftcopy}
332 \newcommand{\xx}{
333 Test3: This is a test page \thepage \vfill
334 This is a testpage \thepage \newpage

335 }

336 \begin{document}
337 Should print BROUILLON on the first two pages, light.\\
338 \verb|\usepackage[light,firsttwo]{draftcopy}|\\
339 \xx\xx\xx\xx
340 \end{document}

341 ⟨/test3⟩

342 ⟨∗test4⟩

343 \documentclass[a4paper,danish]{article}
344 \usepackage[light,firsttwo]{draftcopy}
345 \newcommand{\xx}{
346 Test4: This is a test page \thepage \vfill
347 This is a testpage \thepage \newpage

348 }

349 \draftcopyLastPage{3}
350 \begin{document}

351 Should print UDKAST on the first three pages, light.\\
352 \verb|\usepackage[light,firsttwo]{draftcopy}|\\
353 \verb|\draftcopyLastPage{3}|\\
354 \xx\xx\xx\xx
355 \end{document}

356 ⟨/test4⟩

357 ⟨∗test5⟩

358 \documentclass[a4paper,dutch]{article}
359 \usepackage[none,bottom]{draftcopy}
360 \newcommand{\xx}{
361 Test5: This is a test page \thepage \vfill
362 This is a testpage \thepage \newpage

363 }

364 \begin{document}
365 Should print ONTWERP only at the bottom each page.\\
366 \verb|\usepackage[none,bottom]{draftcopy}|\\
367 \xx\xx\xx\xx
368 \end{document}

369 ⟨/test5⟩

370 ⟨∗test6⟩

371 \documentclass[a4paper,finnish]{article}
372 \usepackage[firsttwo,light,bottom]{draftcopy}
373 \newcommand{\xx}{
374 test6: This is a test page \thepage \vfill
375 This is a testpage \thepage \newpage

376 }

377 \begin{document}
378 Should print VEDOS on the first two pages, light.\\
379 Should print VEDOS at the bottom each page.\\
380 \verb|\usepackage[firsttwo,light,bottom]{draftcopy}|\\
381 \xx\xx\xx\xx
382 \end{document}

383 ⟨/test6⟩

384 ⟨∗test7⟩

385 \documentclass[a4paper,norsk]{article}
386 \usepackage[light,firsttwo,bottomafter]{draftcopy}
387 \newcommand{\xx}{
388 Test7: This is a test page \thepage \vfill
389 This is a testpage \thepage \newpage

390 }

391 \begin{document}
392 Should print UTKAST on the first two pages, light.\\
393 Should print UTKAST on bottom of the page after the second page.\\
394 \verb|\usepackage[light,firsttwo,bottomafter]{draftcopy}|\\
395 \xx\xx\xx\xx
396 \end{document}

397 ⟨/test7⟩