The draftcopy package^{∗}

Dr. Jürgen Vollmer Viktoriastraße 15 D-76133 Karlsruhe, Germany

Juergen.Vollmer@acm.org

February 25, 2002; Version 2.16

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, finnish and french 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.

outline The word DRAFT is printed with outlined letters. light The word DRAFT is printed with a light grey. dark The word DRAFT is printed with a dark grey. dvips, vtex, textures, … This package accepts the options of the graphics package^{2}.

The graphics package is not loaded by draftcopy.

portrait Page is in portrait shape. landscape Page is in landscape shape. conditional Obey the (global) draft and final options. If conditional

and draft are given, then the DRAFT text is printed. If conditional and final are given, DRAFT is not printed. Only conditional is given, DRAFT is not printed. If conditional is not given then draft and final are ignored, and the DRAFT text is printed always.

draft Print the DRAFT text. final Don’t print any DRAFT text. timestamp Print together with the word DRAFT a timestamp and the

text given by the draftcopyVersion macro.

The default options are: dvips,english,all,dark,portrait, which corresponds to the behaviour of the old implementation of this package. The file draftcopy.cfg specifies the default Postscript driver. This specification is overruled, if the driver option is given explicitly.

2.2 Commands

Additionally to the options, each feature 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.

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

\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. To add spaces in the word use the \space macro.

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

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

\draftcopySetScale • Change the default size of the word DRAFT.

\draftcopySetScaleFactor • Change the multipiler of the scale.

\draftcopyPageTransform • and

\draftcopyBottomTransform • take raw PostScript to set the LL-corner of the DRAFT string Use them before the \begin{document}. For code examples: Have a look to the definition of the portrait and landscape options.

\draftcopyPageX  • and

\draftcopyPageY • are integer values specifying the coorinates starting the DRAFT string on the page (default 0).

\draftcopyBottomX  • and

\draftcopyBottomY • are integer values specifying the coorinates starting the DRAFT string on the bootom line (default 0).

\draftcopyVersion • The argument is printed together with the timestamp.

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.

Currently this package works only for Postscript and not for PDF, sorry.

4 Copyright

Copyright (C) 1995 Dr. Juergen Vollmer, Karlsruhe, Germany

Juergen.Vollmer@acm.org

This program can be redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from CTAN archives in directory macros/latex/base/lppl.txt; either version 1 of the License, or any later version.

If you find this software useful, please send me a postcard.

5 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[english,a4paper]{article}
 3 \usepackage{doc}

 4 \usepackage[latin1]{inputenc}
 5 \usepackage{babel}
 6 \usepackage[light,first,bottomafter]{draftcopy}
 7 \RecordChanges
 8 \EnableCrossrefs
 9 \CodelineIndex
10 \begin{document}
11 \DocInput{draftcopy.doc}
12 \PrintChanges
13 \setcounter{IndexColumns}{2}
14 \PrintIndex
15 \end{document}

16 ⟨/driver⟩

6 Configuration

You should set up the default Postscript driver in the file draftcopy.cfg. For a reasonable value have a look to the file graphics.cfg from the graphics package. The distributed default is dvips.

17 ⟨∗config⟩

18 \ifx\OpMode\undefined
19 \ExecuteOptions{dvips}
20 \else
21 \ExecuteOptions{vtex}
22 \fi

23 ⟨/config⟩

7 The Implementation

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

What do we need, and who we are:

24 ⟨∗package⟩

25 \NeedsTeXFormat{LaTeX2e}
26 \ProvidesPackage{draftcopy}[2002/02/25 v2.16]

Declaration of the conditional handling options (based on an idea of Warren

Smith <wds@research.nj.nec.com>).
27 \newif\ifdraftcopy@conditional
28 \newif\ifdraftcopy@draft
29 \newif\ifdraftcopy@final
30 \DeclareOption{conditional}{
31 \draftcopy@conditionaltrue

32 }

33 \DeclareOption{draft}{
34 \draftcopy@drafttrue

35 }

36 \DeclareOption{final}{
37 \draftcopy@finaltrue

38 }

Declaration of the the timestamp option.

39 %␣Compute␣the␣timestamp␣based␣on␣an␣idea␣of
40 %␣Tim␣Piessens␣\texttt{<Tim.Piessens@esat.kuleuven.ac.be>}.
41 %␣␣␣␣\begin{macrocode*}
42 \def\draftcopy@Timestamp{}
43 \def\draftcopy@version{}
44 \newcount\draftcopy@hour␣\newcount\draftcopy@minute
45 \draftcopy@hour=\time
46 \divide␣\draftcopy@hour␣by␣60
47 \draftcopy@minute=\time
48 \count@=\draftcopy@hour
49 \multiply␣\count@␣by␣-60
50 \advance␣\draftcopy@minute␣by␣\count@
51 \newcommand{\draftcopy@daytime}{%
52 ␣␣␣\ifnum\draftcopy@hour=0␣00\else\ifnum\draftcopy@hour<10␣0\fi%
53 ␣␣␣\number\draftcopy@hour\fi:%
54 ␣␣\ifnum\draftcopy@minute<10␣0\fi\number\draftcopy@minute%

55 }

56

57 \DeclareOption{timestamp}{
58 ␣␣␣\def\draftcopy@Timestamp{%
59 ␣␣␣\draftcopy@Show
60 ␣␣␣\draftcopy@PageX␣\draftcopy@PageY␣-40␣add␣moveto
61 ␣␣␣/Times-Roman␣findfont␣50␣\draftcopy@ScaleFactor␣mul␣scalefont␣setfont
62 ␣␣␣(\draftcopy@version␣\today␣--␣\draftcopy@daytime)
63 ␣␣␣}

64 }

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

65 % VTEX-support: Thanks to "MicroPress Inc." <support@micropress-inc.com>
66 \let\immediate@special=\special
67 \DeclareOption{vtex}{
68 \def\immediate@special{\immediate\special}
69 \immediate@special{!bophook bop-hook}
70 \def\draftcopy@BOPhook{/bop-hook}
71 \def\draftcopy@UserDictCmd{pS: userdict }
72 % MV & AK <mv@micropress-inc.com>

73 }

74 \DeclareOption{dvips}{
75 \def\draftcopy@BOPhook{/bop-hook}
76 \def\draftcopy@UserDictCmd{! userdict }

77 }

78 \DeclareOption{dvipsone}{
79 % thanks to V. P. Stokes <virgil.stokes@neuro.ki.se>
80 % thanks to Y&Y Help Line <support@YandY.com>
81 % thanks to "H. Salehfar" <hsalehfa@sage.und.nodak.edu>
82 \def\draftcopy@BOPhook{/bphook}
83 \def\draftcopy@UserDictCmd{! dvidict}

84 }

85 \DeclareOption{textures}{
86 % thanks to Jerome LAURENS \texttt{laurens@u-bourgogne.fr>
87 \def\draftcopy@BOPhook{/bop-hook}
88 \def\draftcopy@UserDictCmd{prepostscript userdict}

89 }

 91 \DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}}

92

 93 % For the following |dvips| will be used. I don't know it better.
 94 \DeclareOption{xdvi}{\ExecuteOptions{dvips}}
 95 \DeclareOption{dvi2ps}{\ExecuteOptions{dvips}}
 96 \DeclareOption{dvialw}{\ExecuteOptions{dvips}}
 97 \DeclareOption{dvilaser}{\ExecuteOptions{dvips}}
 98 \DeclareOption{dvitops}{\ExecuteOptions{dvips}}
 99 \DeclareOption{emtex}{\ExecuteOptions{dvips}}
100 \DeclareOption{dviwin}{\ExecuteOptions{dvips}}
101 \DeclareOption{oztex}{\ExecuteOptions{dvips}}
102 \DeclareOption{psprint}{\ExecuteOptions{dvips}}
103 \DeclareOption{pubps}{\ExecuteOptions{dvips}}
104 \DeclareOption{pctexps}{\ExecuteOptions{dvips}}
105 \DeclareOption{pctexwin}{\ExecuteOptions{dvips}}
106 \DeclareOption{pctexhp}{\ExecuteOptions{dvips}}
107 \DeclareOption{ln}{\ExecuteOptions{dvips}}

To printed the word DRAFT in outlined letter or normal letters we use different methods of showing text: Normal letters are printed using the PostScript show command. Outlined letters are printed using charpath and stroke (See the example in the red PostScipt book). The idea for this option is from Harriet

 B. Borton <bortonh@rpi.edu>
108 \def\draftcopy@Show{show␣}
109 \DeclareOption{outline}{
110 ␣␣\def\draftcopy@Show{false␣charpath␣2␣setlinewidth␣stroke␣}

111 }

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

112 \DeclareOption{light}{
113  \def\draftcopy@GrayValue{0.90}

114 }

115

116 \DeclareOption{dark}{
117  \def\draftcopy@GrayValue{0.85}

118 }

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.

119 \DeclareOption{none}{
120 \def\draftcopy@LastPage{0}

121 }

122 \DeclareOption{first}{
123 \def\draftcopy@LastPage{1}

124 }

125 \DeclareOption{firsttwo}{
126 \def\draftcopy@LastPage{2}

127 }

128 \DeclareOption{all}{
129 \def\draftcopy@LastPage{99999}

130 }

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>.
131 \newif\ifdraftcopy@bottom
132 \DeclareOption{bottom}{
133 \draftcopy@bottomtrue

134 }

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

135 \newif\ifdraftcopy@bottomAfter
136 \DeclareOption{bottomafter}{
137 \draftcopy@bottomAftertrue

138 }

Define the word DRAFT and its scaling, in case no language option is given. 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.

139 \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. Most of them use latin characters, hence we use Times-Roman. The macro draftcopy@Font holds the font name.

140 \def\draftcopy@Font{/Times-Roman}
141 \DeclareOption{american}{
142 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

143 }

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

146 }

147 \DeclareOption{bahasa}{
148 ␣␣%␣thanks␣to␣Glenn␣G.␣Chappell␣<gchappell@semovm.semo.edu>
149 ␣␣\def\draftcopy@Name{DRAF}\def\draftcopy@Scale{217}

150 }

151 \DeclareOption{brazil}{
152 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

153 }

154 \DeclareOption{brazilian}{
155 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

156 }

157 \DeclareOption{breton}{
158 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

159 }

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

162 }

163 \DeclareOption{catalan}{
164 ␣␣%␣thanks␣to␣Dav␣<davpuig@mx3.redestb.es>
165 ␣␣%␣thanks␣to␣Xavier␣<xml@mat.upc.es>
166 ␣␣\def\draftcopy@Name{ESBORRANY}\def\draftcopy@Scale{110}

167 }

168 \DeclareOption{croatian}{
169 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

171 \DeclareOption{czech}{
172 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

173 }

174 \DeclareOption{danish}{
175 ␣␣%␣thanks␣to␣Ejnar␣Zacho␣Rath␣<ezr@md-oss.dk>,
176 ␣␣%␣thanks␣to␣Bjarne␣Vestergaard␣<bvbruder@dfi.aau.dk>
177 ␣␣%␣thanks␣to␣Joergen␣Larsen␣<JL@mmf.ruc.dk>
178 ␣␣\def\draftcopy@Name{UDKAST}\def\draftcopy@Scale{175}

179 }

180 \DeclareOption{dutch}{
181 ␣␣%␣thanks␣to␣Kees␣Leune␣<C.J.Leune@kub.nl>
182 ␣␣%␣\def\draftcopy@Name{CONCEPT}\def\draftcopy@Scale{150}
183 ␣␣%␣thanks␣to␣Anton␣Stoorvogel␣<wscoas@as.win.tue.nl>␣porposed
184 ␣␣\def\draftcopy@Name{ONTWERP}\def\draftcopy@Scale{150}

185 }

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

188 }

189 \DeclareOption{esperanto}{
190 ␣␣%␣thanks␣to␣Stephan␣B.␣Webanck␣<webanck@mpiz-koeln.mpg.de>
191 ␣␣\def\draftcopy@Name{MALNETO}\def\draftcopy@Scale{160}

192 }

193 \DeclareOption{estonian}{
194 ␣␣%␣thanks␣to␣DAVID␣FEEST␣<mirka!mausgoe.central.de!
195 ␣␣%␣gOe.maus.de!David_Feest@uranus.central.de>
196 ␣␣\def\draftcopy@Name{VISAND}\def\draftcopy@Scale{215}

197 }

198 \DeclareOption{finnish}{
199 ␣␣%␣thanks␣to␣Jaakko␣Ruohio␣<jjruohio@boojum.hut.fi>
200 ␣␣\def\draftcopy@Name{LUONNOS}\def\draftcopy@Scale{200}
201 ␣␣%␣thanks␣to␣Mika␣Grundstroem␣<mikagr@spittari.cs.tut.fi>
202 ␣␣\def\draftcopy@Name{VEDOS}\def\draftcopy@Scale{220}

203 }

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

207 }

208 \DeclareOption{french}{
209 ␣␣%␣thanks␣to␣Christophe␣Couvreur␣<couvreur@Thor.fpms.ac.be>
210 ␣␣\def\draftcopy@Name{BROUILLON}\def\draftcopy@Scale{120}
211 ␣␣%␣thanks␣to␣Marc␣Torzynski␣<marc@snoopy.u-strasbg.fr>
212 ␣␣%\def\draftcopy@Name{EPREUVE}\def\draftcopy@Scale{120}

213 }

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

216 }

217 \DeclareOption{german}{
218 ␣␣\def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155}

219 }

220 \DeclareOption{germanb}{
221 ␣␣\def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155}

222 }

223 \DeclareOption{greek}{

224 ␣␣%␣thanks␣to␣␣Apostolos␣Syropoulos␣<apostolo@ocean1.ee.duth.gr>
225 ␣␣\def\draftcopy@Name{PROSCEDIO}\def\draftcopy@Scale{85}
226 ␣␣\def\draftcopy@Font{/Symbol}

227 }

228 \DeclareOption{hungarian}{
229 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

230 }

231 \DeclareOption{icelandic}{
232 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
233 ␣␣%␣DRÖG
234 ␣␣%␣Erlendur␣S␣Thorsteinsson␣<esth@cmu.edu>
235 ␣␣%␣does␣anybody␣knows␣how␣to␣create␣PostScript␣for␣that␣letter␣Ö?

236 }

237 \DeclareOption{irish}{
238 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
239 ␣␣%␣DRÉACHT
240 ␣␣%␣Breanndán␣Ó␣Nualláin␣<bon@kotona.demon.nl>
241 ␣␣%␣does␣anybody␣knows␣how␣to␣create␣PostScript␣for␣that␣letter␣É?

242 }

243 \DeclareOption{italian}{
244 ␣␣%␣thanks␣to␣Fabio␣Massacci␣<Fabio.Massacci@cl.cam.ac.uk>
245 ␣␣%␣thanks␣to␣Paolo␣Dell'Aquila␣<dlle07k1@mo.nettuno.it>
246 ␣␣\def\draftcopy@Name{BOZZA}\def\draftcopy@Scale{215}
247 ␣␣%␣thanks␣to␣Giuseppe␣De␣Arcangelis␣<gdearc@serifos.caspur.it>
248 ␣␣%␣\def\draftcopy@Name{brutta␣copia}\def\draftcopy@Scale{80}

249 }

250 \DeclareOption{lowersorbian}{
251 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

252 }

253 \DeclareOption{magyar}{
254 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

255 }

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

259 }

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

263 }

264 \DeclareOption{polish}{
265 ␣␣%␣thanks␣to␣Piotr␣Chrusciel␣<piotr@gargan.math.univ-tours.fr>
266 ␣␣\def\draftcopy@Name{BRUDNOPIS}\def\draftcopy@Scale{120}

267 }

268 \DeclareOption{portuges}{
269 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

270 }

271 \DeclareOption{portuguese}{
272 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

273 }

274 \DeclareOption{romanian}{
275 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

276 }

277 \DeclareOption{scottish}{

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

279 }

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

283 }

284 \DeclareOption{slovak}{
285 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

286 }

287 \DeclareOption{slovene}{
288 ␣␣%␣thanks␣to␣brodnik@pegam.mat.uni-lj.si␣<Andrej␣Brodnik>
289 ␣␣\def\draftcopy@Name{OSNUTEK}\def\draftcopy@Scale{120}

290 }

291 \DeclareOption{swedish}{
292 ␣␣%␣thanks␣to␣<matsd@physchem.kth.se>
293 ␣␣\def\draftcopy@Name{UTKAST}\def\draftcopy@Scale{185}

294 }

295 \DeclareOption{turkish}{
296 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

297 }

298 \DeclareOption{uppersorbian}{
299 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

300 }

Declare the page orientation options.

301 \DeclareOption{portrait}{
302 % thanks to Ross MOORE \texttt{ross@maths.mq.edu.au>}
303 \def\draftcopy@PageTranslate{200 70 translate 65 rotate}
304 \def\draftcopy@BottomTranslate{0 25 translate}
305 \def\draftcopy@ScaleFactor{1 }

306 }

307 \DeclareOption{landscape}{
308 % thanks to Ross MOORE \texttt{ross@maths.mq.edu.au>}
309 \def\draftcopy@PageTranslate{70 450 translate 25 neg rotate}
310 \def\draftcopy@BottomTranslate{25 650 translate 90 neg rotate}
311 \def\draftcopy@ScaleFactor{0.6 }

312 }

Use these default options,

313 \ExecuteOptions{dark,all,english,portrait}

instead of dvips use the graphics driver specified in the configuration file,

314 \input{draftcopy.cfg}

and the process the user options.

315 \ProcessOptions

Tell the user what’s ongoing.

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

\draftcopyVersion Set the Version text to be printed together with a timestamp

318 \newcommand{\draftcopyVersion}[1]{
319 \def\draftcopy@version{#1}

320 }

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

321 \newcommand{\draftcopySetGrey}[1]{
322 \def\draftcopy@GrayValue{#1}

323 }

\draftcopySetScale Set the size (scale) of the word DRAFT. You may need this, if you use another paper format. The default scales are for A4 paper. If used, it must be conatined in the preamble of the document.

324 \newcommand{\draftcopySetScale}[1]{
325 \def\draftcopy@Scale{#1}

326 }

\draftcopySetScaleFactor Set the scale muliplier of the scale.

327 \newcommand{\draftcopySetScaleFactor}[1]{
328 ␣␣\def\draftcopy@ScaleFactor{#1␣}

329 }

\draftcopyFirstPage The argument specifies the first 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.

330 \def\draftcopy@FirstPage{0}
331 \newcommand{\draftcopyFirstPage}[1]{
332 \def\draftcopy@FirstPage{#1}

333 }

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

334 \newcommand{\draftcopyLastPage}[1]{
335 \def\draftcopy@LastPage{#1}

336 }

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

337 \newcommand{\draftcopyName}[2]{
338 ␣␣\def\draftcopy@Name{#1}
339 ␣␣\def\draftcopy@Scale{#2}

340 }

\@draftcopyTilde If a ĩs used as argument of \draftcopyName, we have to supress expansion of it. We replace it by a simple space. Here we store the original meaning of ˜, so that it can be restored after setting up the Postscript code.

341 \let\@draftcopyTilde~

\draftcopyPageTransform These next 2 commands take raw PostScript to set the LL-corner of the DRAFT string

342 \newcommand{\draftcopyPageTransform}[1]{%
343 ␣\def\draftcopy@PageTranslate{#1}%

344 }

\draftcopyBottomTransform
345 \newcommand{\draftcopyBottomTransform}[1]{%
346 ␣\def\draftcopy@BottomTranslate{#1}%

347 }

Based on an idea or Sergio Polini <s.polini@mclink.it>:

\draftcopyPageX
348 \def\draftcopy@PageX{0␣}
349 \newcommand{\draftcopyPageX}[1]{%
350 ␣\def\draftcopy@PageX{#1␣}%

351 }

\draftcopyPageY
352 \def\draftcopy@PageY{0␣}
353 \newcommand{\draftcopyPageY}[1]{%
354 ␣\def\draftcopy@PageY{#1␣}%

355 }

\draftcopyBottomX
356 \def\draftcopy@BottomX{0␣}
357 \newcommand{\draftcopyBottomX}[1]{%
358 ␣\def\draftcopy@BottomX{#1␣}%

359 }

\draftcopyBottomY
360 \def\draftcopy@BottomY{0␣}
361 \newcommand{\draftcopyBottomY}[1]{%
362 ␣\def\draftcopy@BottomY{#1␣}%

363 }

Compute, wether we should show the DRAFT text:

364 \newif\ifdraftcopy@showit
365 \ifdraftcopy@conditional
366 ␣␣\ifdraftcopy@draft
367 ␣␣␣␣␣\draftcopy@showittrue
368 ␣␣\else
369 ␣␣␣␣␣␣\draftcopy@showitfalse
370 ␣␣\fi
371 ␣␣\ifdraftcopy@final
372 ␣␣␣␣\draftcopy@showitfalse
373 ␣␣\fi
374 \else
375 ␣␣\draftcopy@showittrue
376 \fi

Here we introduce some Postscript code. The dictionary userdict is extended with the page counter draftcopy-CurrentPage. Printing of DRAFT starts after page \draftcopy@FirstPage. 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.

We redfefine and restore the meaning of ˜, which may be used in the

 \draftcopy@Name, using \let. This allows to use \today as \draftcopy@Name

for languages like e.g. german, which separates the day and the month by ˜.

The size of the word DRAFT is given by \draftcopy@Scale and multiplied by \draftcopy@ScaleFactor, which is needed to different page hights of cover landscape and portrait orientation.

Thanks to Glenn G. Chappell gchappell@semovm.semo.edu for providing the /draftcopy-old-BOPhook suggestion, which saves a previous definition of

 \draftcopy@BOPhook and executes it too.
377 % Thanks to Ross Moore \texttt{ross@ics.mq.edu.au} for adding the code to
378 % preserve kine-end in the PostScript file.
379 %    \begin{macrocode}
380 \ifdraftcopy@showit
381 {\obeyspaces
382 \ifdraftcopy@bottomAfter
383 \AtBeginDocument{
384  \let~\space
385  \immediate@special{\draftcopy@UserDictCmd
386  begin
387  /draftcopy-CurrentPage 0 def
388  /draftcopy-old-BOPhook { } def
389  currentdict \draftcopy@BOPhook\space known{
390  /draftcopy-old-BOPhook \draftcopy@BOPhook\space load def
391  } if
392  \draftcopy@BOPhook{
393  draftcopy-old-BOPhook
394  /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
395  draftcopy-CurrentPage \draftcopy@FirstPage ge
396  draftcopy-CurrentPage \draftcopy@LastPage le
397  and
398  { gsave \draftcopy@PageTranslate
399  \draftcopy@Font findfont
400  \draftcopy@Scale \draftcopy@ScaleFactor mul scalefont setfont
401  \draftcopy@PageX \draftcopy@PageY moveto
402  \draftcopy@GrayValue setgray
403  (\draftcopy@Name) \draftcopy@Timestamp \draftcopy@Show
404  grestore
405  } if
406  draftcopy-CurrentPage \draftcopy@LastPage gt
407  { gsave \draftcopy@BottomTranslate
408  \draftcopy@Font findfont
409  25 scalefont setfont
410  \draftcopy@BottomX \draftcopy@BottomY moveto
411  \draftcopy@GrayValue setgray
412  (\draftcopy@Name\space\space--\space\space)
413  0 1 15 { pop dup show } for
414  grestore
415  } if
416  } def
417  end

418 }

419  \let~\@draftcopyTilde

420 }

421 \else\ifdraftcopy@bottom
422 \AtBeginDocument{
423  \let~\space
424  \immediate@special{\draftcopy@UserDictCmd
425  begin
426  /draftcopy-CurrentPage 0 def
427  /draftcopy-old-BOPhook { } def
428  currentdict \draftcopy@BOPhook\space known{
429  /draftcopy-old-BOPhook \draftcopy@BOPhook\space load def
430  } if
431  \draftcopy@BOPhook{
432  draftcopy-old-BOPhook
433  /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
434  draftcopy-CurrentPage \draftcopy@FirstPage ge
435  draftcopy-CurrentPage \draftcopy@LastPage  le
436  and
437  { gsave \draftcopy@PageTranslate
438  \draftcopy@Font findfont
439  \draftcopy@Scale \draftcopy@ScaleFactor mul scalefont setfont
440  \draftcopy@PageX \draftcopy@PageY moveto
441  \draftcopy@GrayValue setgray
442  (\draftcopy@Name) \draftcopy@Timestamp \draftcopy@Show
443  grestore
444  }if
445  gsave \draftcopy@BottomTranslate
446  \draftcopy@Font findfont
447  25 scalefont setfont
448  \draftcopy@BottomX \draftcopy@BottomY moveto
449  \draftcopy@GrayValue setgray
450  (\draftcopy@Name\space\space--\space\space)
451  0 1 15 { pop dup show } for
452  grestore
453  } def
454  end

455 }

456  \let~\@draftcopyTilde

457 }

458 \else
459 \AtBeginDocument{
460  \let~\space
461  \immediate@special{\draftcopy@UserDictCmd
462  begin
463  /draftcopy-CurrentPage 0 def
464  /draftcopy-old-BOPhook { } def
465  currentdict \draftcopy@BOPhook\space known{
466  /draftcopy-old-BOPhook \draftcopy@BOPhook\space load def
467  } if
468  \draftcopy@BOPhook{
469  draftcopy-old-BOPhook
470  /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
471  draftcopy-CurrentPage \draftcopy@FirstPage ge
472  draftcopy-CurrentPage \draftcopy@LastPage  le

473  and
474  { gsave \draftcopy@PageTranslate
475  \draftcopy@Font findfont
476  \draftcopy@Scale \draftcopy@ScaleFactor mul scalefont setfont
477  \draftcopy@PageX \draftcopy@PageY moveto
478  \draftcopy@GrayValue setgray
479  (\draftcopy@Name) \draftcopy@Timestamp \draftcopy@Show
480  grestore
481  } if
482  } def
483  end

484 }

485  \let~\@draftcopyTilde

486 }

487 \fi\fi

488 }

489 \fi

490 ⟨/package⟩

8 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, ...  test12 option.

491 ⟨∗test1⟩

492 \documentclass[a4paper]{article}
493 \usepackage{draftcopy}
494 \newcommand{\xx}{
495 Test 1\\This is a test page \thepage \vfill
496 This is a testpage \thepage \newpage

497 }

498 \begin{document}
499 Should print DRAFT over all pages, quite dark.\\
500 \verb|\usepackage{draftcopy}|\\
501 \xx\xx\xx\xx
502 \end{document}

503 ⟨/test1⟩

504 ⟨∗test2⟩

505 \documentclass[a4paper,german]{article}
506 \usepackage[light,first]{draftcopy}
507 \newcommand{\xx}{
508 Test2: Should print ENTWURF on the first page, light.\\
509 This is a test page \thepage \vfill
510 This is a testpage \thepage \newpage

511 }

512 \begin{document}
513 \verb|\usepackage[light,first]{draftcopy}|\\
514 \xx\xx\xx\xx
515 \end{document}

516 ⟨/test2⟩

517 ⟨∗test3⟩

518 \documentclass[a4paper,french]{article}

519 \usepackage[light,firsttwo]{draftcopy}
520 \newcommand{\xx}{
521 Test3: This is a test page \thepage \vfill
522 This is a testpage \thepage \newpage

523 }

524 \begin{document}
525 Should print BROUILLON on the first two pages, light.\\
526 \verb|\usepackage[light,firsttwo]{draftcopy}|\\
527 \xx\xx\xx\xx
528 \end{document}

529 ⟨/test3⟩

530 ⟨∗test4⟩

531 \documentclass[a4paper,danish]{article}
532 \usepackage[light,firsttwo]{draftcopy}
533 \newcommand{\xx}{
534 Test4: This is a test page \thepage \vfill
535 This is a testpage \thepage \newpage

536 }

537 \draftcopyFirstPage{2}
538 \draftcopyLastPage{3}
539 \begin{document}
540 Should print UDKAST on the second and third pages, light.\\
541 \verb|\usepackage[light,firsttwo]{draftcopy}|\\
542 \verb|\draftcopyFirstPage{2}|\\
543 \verb|\draftcopyLastPage{3}|\\
544 \xx\xx\xx\xx
545 \end{document}

546 ⟨/test4⟩

547 ⟨∗test5⟩

548 \documentclass[a4paper,dutch]{article}
549 \usepackage[none,bottom]{draftcopy}
550 \newcommand{\xx}{
551 Test5: This is a test page \thepage \vfill
552 This is a testpage \thepage \newpage

553 }

554 \begin{document}
555 Should print ONTWERP only at the bottom each page.\\
556 \verb|\usepackage[none,bottom]{draftcopy}|\\
557 \xx\xx\xx\xx
558 \end{document}

559 ⟨/test5⟩

560 ⟨∗test6⟩

561 \documentclass[a4paper,finnish]{article}
562 \usepackage[firsttwo,light,bottom]{draftcopy}
563 \newcommand{\xx}{
564 test6: This is a test page \thepage \vfill
565 This is a testpage \thepage \newpage

566 }

567 \begin{document}
568 Should print VEDOS on the first two pages, light.\\
569 Should print VEDOS at the bottom each page.\\
570 \verb|\usepackage[firsttwo,light,bottom]{draftcopy}|\\
571 \xx\xx\xx\xx

572 \end{document}

573 ⟨/test6⟩

574 ⟨∗test7⟩

575 \documentclass[a4paper,norsk]{article}
576 \usepackage[light,bottomafter]{draftcopy}
577 \newcommand{\xx}{
578 Test7: This is a test page \thepage \vfill
579 This is a testpage \thepage \newpage

580 }

581 \draftcopyFirstPage{2}
582 \draftcopyLastPage{3}
583 \begin{document}
584 Should print UTKAST on the on the pages 2 and 3, light.\\
585 Should print UTKAST on bottom of the page after the third page.\\
586 \verb|\usepackage[light,bottomafter]{draftcopy}|\\
587 \verb|\draftcopyFirstPage{2}|\\
588 \verb|\draftcopyLastPage{3}|\\
589 \xx\xx\xx\xx
590 \end{document}

591 ⟨/test7⟩

592 ⟨∗test8⟩

593 \documentclass[a4paper,nynorsk]{article}
594 \usepackage[light,firsttwo,outline,bottomafter]{draftcopy}
595 \newcommand{\xx}{
596 Test8: This is a test page \thepage \vfill
597 This is a testpage \thepage \newpage

598 }

599 \begin{document}
600 Should print FRAMLEGG on the first two pages, light, outlined.\\
601 Should print FRAMLEGG on bottom of the page after the second page.\\
602 \verb|\usepackage[light,firsttwo,outline,bottomafter]{draftcopy}|\\
603 \xx\xx\xx\xx
604 \end{document}

605 ⟨/test8⟩

606 ⟨∗test9⟩

607 \documentclass{article}
608 \usepackage[light,firsttwo,outline,bottomafter]{draftcopy}
609 \newcommand{\xx}{
610 Test9: This is a test page \thepage\\
611 test~the~tilde~tilde~tilde (1 fixed space (\~{})  between the words)\\
612 test~~the~~tilde~~tilde~~tilde (2 fixed spaces (\~{}) between the words)\\
613 test~~~the~~~tilde~~~tilde~~~tilde (3 fixed spaces (\~{}) between the words)
614 \vfill
615 This is a testpage \thepage \newpage

616 }

617 \draftcopyName{Release\space\space\space\today}{130}
618 \draftcopySetScale{80}
619 \begin{document}
620 Should print the word \verb+Release+  and the current date \verb|\today|
621 (in english) on the first two pages, light, outlined.\\
622 Should print the word \verb+Release+  and current date \verb|\today|
623 (in english) on bottom of the page after the second page.\\
624 Check that the lines with \~{} have correct spacing.\\

625 \verb|\usepackage[light,firsttwo,outline,bottomafter]{draftcopy}|\\
626 and \\
627 \verb|\draftcopyName{Release\space\space\space\today}{130}|\\
628 \verb|\draftcopySetScale{80}|\\
629 in the preamble
630 \xx\xx\xx\xx
631 \end{document}

632 ⟨/test9⟩

633 ⟨∗test10⟩

634 \documentclass[german]{article}
635 \usepackage{babel}
636 \usepackage[light,firsttwo,outline,bottomafter]{draftcopy}
637 \newcommand{\xx}{
638 Test10: This is a test page \thepage \\
639 test~the~tilde~tilde~tilde (1 fixed space (\~{}) between the words)\\
640 test~~the~~tilde~~tilde~~tilde (2 fixed spaces (\~{}) between the words)\\
641 test~~~the~~~tilde~~~tilde~~~tilde (3 fixed spaces (\~{}) between the words)
642 \vfill
643 This is a testpage \thepage \newpage

644 }

645 \draftcopyName{\today}{130}
646 \draftcopySetScale{80}
647 \begin{document}
648 Should print the current date \verb|\today| (in german) on the first two pages,
649 light, outlined.\\
650 Should print the current date \verb|\today| (in german) on bottom of the page
651 after the second page.\\
652 Check that the lines with \~{}) have correct spacing.\\
653 \verb|\usepackage[light,firsttwo,outline,bottomafter]{draftcopy}|\\
654 and \\
655 \verb|\draftcopyName{\today}{130}|\\
656 \verb|\draftcopySetScale{80}|\\
657 in the preamble
658 \xx\xx\xx\xx
659 \end{document}

660 ⟨/test10⟩

661 ⟨∗test11⟩

662 \documentclass[landscape,a4paper]{article}
663 \usepackage[landscape]{draftcopy}
664 \newcommand{\xx}{
665 Test 11\\This is a test page with landscape option \thepage \vfill
666 This is a testpage \thepage \newpage

667 }

668 \begin{document}
669 Should print DRAFT over all pages, quite dark.\\
670 \verb|\usepackage[landscape]{draftcopy}|\\
671 \xx\xx\xx\xx
672 \end{document}

673 ⟨/test11⟩

674 ⟨∗test12⟩

675 \documentclass[landscape,german,a4paper]{article}
676 \usepackage[landscape,bottom]{draftcopy}
677 \newcommand{\xx}{

678 Test 12\\This is a test page \thepage \vfill
679 This is a testpage \thepage \newpage

680 }

681 \begin{document}
682 Should print ENTWURF over all pages, quite dark and on the bottom and with
683 landscape orientation.\\
684 \verb|\usepackage[landscape,bottom]{draftcopy}|\\
685 \xx\xx\xx\xx
686 \end{document}

687 ⟨/test12⟩

688 ⟨∗test13⟩

689 \documentclass[a4paper]{article}
690 \usepackage[conditional]{draftcopy}
691 \newcommand{\xx}{
692 Test 13\\This is a test page \thepage \vfill
693 This is a testpage \thepage \newpage

694 }

695 \begin{document}
696 Should \emph{NOT} print DRAFT since, conditional is used.\\
697 \verb|\usepackage[conditional]{draftcopy}|\\
698 \xx\xx\xx\xx
699 \end{document}

700 ⟨/test13⟩

701 ⟨∗test14⟩

702 \documentclass[draft,a4paper]{article}
703 \usepackage[conditional]{draftcopy}
704 \newcommand{\xx}{
705 Test 14\\This is a test page \thepage \vfill
706 This is a testpage \thepage \newpage

707 }

708 \begin{document}
709 Should print DRAFT since, conditional and draft are used.\\
710 \verb|\usepackage[conditional]{draftcopy}|\\
711 \xx\xx\xx\xx
712 \end{document}

713 ⟨/test14⟩

714 ⟨∗test15⟩

715 \documentclass[final,a4paper]{article}
716 \usepackage[conditional]{draftcopy}
717 \newcommand{\xx}{
718 Test 15\\This is a test page \thepage \vfill
719 This is a testpage \thepage \newpage

720 }

721 \begin{document}
722 Should \emph{NOT} print DRAFT since, final is used (as global option).\\
723 \verb|\usepackage{draftcopy}|\\
724 \xx\xx\xx\xx
725 \end{document}

726 ⟨/test15⟩

727 ⟨∗test16⟩

728 \documentclass[a4paper,greek]{article}
729 \usepackage[timestamp,bottom]{draftcopy}
730 \newcommand{\xx}{

731 Test 16\\This is a test page \thepage \vfill
732 This is a testpage \thepage \newpage

733 }

734 \draftcopyPageX{300}
735 \draftcopyPageY{100}
736 \draftcopyBottomX{300}
737 \draftcopyBottomY{100}
738 \draftcopySetScaleFactor{0.5}
739 \draftcopyVersion{Version 2.14: }
740 \begin{document}
741 Should print DRAFT (in greek translation and greek letters)
742 on a moved position.\\
743 \verb|\usepackage[timestamp,bottom,greek]{draftcopy}|\\
744 \xx\xx\xx\xx
745 \end{document}

746 ⟨/test16⟩