1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
|
\iffalse%
LaTeX Style: editbar.sty 1.3
Written by: Michael R. Van Geest
Unisys Corp.
M.S. 4522
2276 Highcrest Road
Roseville, MN 55113
Internet: mrv@unirsvl.rsvl.unisys.com
Date: January 7, 1994
TeX Drivers Supported: DVIPS
General Information:
editbar.sty is a LaTeX style to be used to print edit bars
(change bars) with PostScript as the final output.
DVIPS is the only driver currently supported, but others could
be used.
Generation of edit bars on one page and/or spanning
multiple pages.
The output routine of LaTeX is modified to include the edit
bar commands to span multiple pages.
Macro usage:
ebarsetup - Place before \begin{document}
ebarcleanup - Place before \end{document}
It is adviseable to put a \clearpage before
\ebarcleanup.
genebaron - Start generating edit bars.
genebaroff - End generating edit bars.
Counters that can be modified are:
\ebaroddside - Distance in points from the left side of the
paper to where the edit bar on the odd side
of the paper is placed.
Currently set to 508.
\ebarevenside - Distance in points from the left side of the
paper to where the edit bar on the even side
of the paper is placed.
Currently set to -30.
\ebarbarheight - Height of edit bar in points on current line.
Currently set to 12 (1 pica).
\ebarbarwidth - Edit bar width in points, currently set to 2.
Auxilary files that are created are:
\jobname.ebo - Edit bar out file.
\count0 is written to this file in the output
routine by the \write command.
\jobname.ebi - Edit bar in file. The contents of \jobname.ebo
are copied to this file after 1 pass of LaTeX.
This file is used as input to the genebaron
and genebaroff macros to find out which page(s)
to place the edit bars.
Restrictions:
- Does not span multiple chapters. The edit bar must
end at the chapter. This is because count0 is used
as the edit bar counter to place on odd or even sides
if two sided styles are used. If one sided styles
are used, the odd side edit bar code is used.
- Nested edit bars are not supported.
Examples:
\genebaron Text \genebaron text \genebaroff
\genebaron Text \genebaroff text \genebaroff
- Does support paper resolution. The DVIPS
PostScript def Resolution is used.
- Edit bars in Longtable.sty should work.
Sample Usage:
\documentstyle[editbar]{book}
%
\ebarsetup{}%
%
\begin{document}
%
Paragraph on page 1
%
\newpage
This paragraph \genebaron{}has an edit bar on it.
%
\newpage
%
This is a paragraph that has an edit bar around it.
%
This \genebaroff{}is a paragraph with end edit bar that ends it.
More stuff.
More stuff.
More stuff.
More stuff.
More stuff.
More stuff.
More stuff.
More stuff.
More stuff.
More stuff.
More stuff.
More stuff.
More stuff.
More stuff.
%
\clearpage\ebarcleanup{}%
\end{document}
\fi%
\def\fileversion{v1.3}
\def\filedate{07JAN94}
\wlog{Style-Option: `editbar' \fileversion \space\space <\filedate> (M.R.V.G.)}
% Dimen Register - truepagetotal
%
% This is set in the sample output routine. Must be used for edit bars
% to work correctly.
%
\newdimen\truepagetotal
%
%
% Read Register - ebarin
% Edit Bar read in file
%
\newread\ebarin
% Write Register - ebarout
% Edit Bar write out file
%
\newwrite\ebarout
% Count Register - ebarnest
%
\newcount\ebarnest
\ebarnest=0
% Count Register - ebaronpagedelay
%
\newcount\ebaronpagedelay
\ebaronpagedelay=0
% Count Register - ebaroddside
%
\newcount\ebaroddside
\ebaroddside=508
% Count Register - ebarevenside
%
\newcount\ebarevenside
\ebarevenside=-30
% Count Register - ebarbarwidth
%
\newcount\ebarbarwidth
\ebarbarwidth=2
% Count Register - ebarbarheight
%
\newcount\ebarbarheight
\ebarbarheight=12
% Count Register - ebarpagesspan
%
\newcount\ebarpagesspan
\ebarpagesspan=0
% Count Register - ebaroncapture
%
\newcount\ebaroncapture
\ebaroncapture=0
% Count Register - ebaroncapturesave
%
\newcount\ebaroncapturesave
\ebaroncapturesave=0
% Count Register - ebaroffcapture
%
\newcount\ebaroffcapture
\ebaroffcapture=0
% Count Register - ebarsubtract
%
\newcount\ebarsubtract
\ebarsubtract=0
% If - ifebarfileopen
% Checks to see if the ebarfile is open
%
\newif\ifebarfileopen
%
% ebarsetup
%
% Sets up the input and output ebar files
%
% Place at the top of the document
%
\globaldefs1%
\def\ebarsetup{%
\immediate\openin\ebarin=\jobname.ebi %
\ifeof\ebarin%
\typeout{No file \jobname.ebi}%
\global\ebarfileopenfalse%
\else%
\global\ebarfileopentrue%
\fi%
\immediate\openout\ebarout=\jobname.ebo %
}%
%
% ebarcleanup
%
% Closes the ebar output file, then opens the ebar output file for read,
% then copies the ebar output file to the ebar input file for the next
% pass to read the ebar input file
%
% Place at the end of the document
%
\def\ebarcleanup{%
\immediate\closein\ebarin%
\immediate\closeout\ebarout%
%%
\immediate\openin\ebarin=\jobname.ebo %
\immediate\openout\ebarout=\jobname.ebi %
%%
\ebarfileopentrue%
%%
\loop%
\immediate\read\ebarin to \ebarinin%
\ifeof\ebarin%
\ebarfileopenfalse%
\fi%
\ifebarfileopen%
\immediate\write\ebarout{\ebarinin}%
\repeat%
%%
\closein\ebarin%
\closeout\ebarout%
}%
%
% ebargeton
%
% Gets the next ebar reference from the ebar input file
%
% Specifically, gets the relative page number output from the prior
% pass of genebar macro
%
\def\ebargeton{%
\immediate%
\ifeof\ebarin%
%
\else%
\immediate\read\ebarin to \ebarinon%
\global\ebaroncapture=\ebarinon%
\global\ebaroncapturesave=\ebarinon%
\fi%
}
%
% ebargetoff
%
% Gets the next ebar reference from the ebar input file
%
% Specifically, gets the relative page number output from the prior
% pass of genebar macro
%
\def\ebargetoff{%
\immediate%
\ifeof\ebarin%
%
\else%
\immediate\read\ebarin to \ebarinoff%
\global\ebaroffcapture=\ebarinoff%
\fi%
}
%
% endebarthispage
%
% Check edit bar status to end an edit bar on this page
%
\def\endebarthispage{%
\ifnum\ebarpagesspan=0%
\else%
\ifnum\ebaroncapturesave>\count0%
\global\ebaronpagedelay=1%
\else%
\genebaroffpage{}%
\fi%
\fi%
}%
%
% beginebarnextpage
%
% Check edit bar status to begin an edit bar on next page
%
\def\beginebarnextpage{%
\ifnum\ebarpagesspan>0%
\ifnum\ebaronpagedelay=1%
\global\ebaronpagedelay=0%
\else
\genebaronpage{}%
\global\advance\ebarpagesspan by -1%
\fi%
\fi%
}%
%
% ebarspecialstart, ebarspecialodd, ebarspecialeven, and ebarspecialend
%
% Start, Odd and even pages, and end special macros
%
\newtoks\ebarendline
\ebarendline={ }%
%
%
\def\ebarspecialstart{%
\special{ps:%
/SPECIALSTART pop % FOR DEBUGGING PostScript
Resolution 72 div /Point exch def % Get points conversion
currentpoint exch pop % Get current Y point
Point \the\ebarbarheight\the\ebarendline %
mul sub /Y1point exch def % Get current Y point
% minus ebar height
}%
}%
%
\def\ebarspecialodd{%
\special{ps:%
/SPECIALODD pop % FOR DEBUGGING PostScript
Point \the\ebaroddside\the\ebarendline %
mul /Xpoint exch def % Get X point
}%
}%
%
\def\ebarspecialeven{%
\special{ps:%
/SPECIALEVEN pop % FOR DEBUGGING PostScript
Point \the\ebarevenside\the\ebarendline %
mul /Xpoint exch def % Get X point
}%
}%
%
\def\ebarspecialend{%
\special{ps:%
/SPECIALEND pop % FOR DEBUGGING PostScript
gsave %
Point \the\ebarbarwidth\the\ebarendline %
mul setlinewidth % Edit Bar width
currentpoint exch pop \the\ebarsubtract\the\ebarendline %
% Get current Y point
Point mul sub /Y2point exch def % minus adjustment
Xpoint Y1point moveto %
Xpoint Y2point lineto stroke %
grestore}%
}%
%
% genebaron
%
% Writes the relative page number to the ebar output file,
% reads from the ebar input file if open and generates the ebar on
%
% Place where the ebar will occur
%
\def\genebaron{%
\write\ebarout{\the\count0}%
\ifeof\ebarin%
\else%
\global\advance\ebarnest by 1 %
%
\ifnum\ebarnest=1 %
\else%
\@latexerr{Edit bar are nested, bad results can occur.}%
{Please use genebaroff before using genebaron}%
\fi%
%
\ebargeton% % Get ebar on page
\ebargetoff% % Get ebar off page
%
\global\ebarpagesspan=\ebaroffcapture% % Get page span
\global\advance\ebarpagesspan by -\ebaroncapture%
%
\special{ps:%
/GENEBARON pop % FOR DEBUGGING PostScript
}%
%
\ebarspecialstart%
%
\if@twoside%
\ifodd\ebaroncapture%
\ebarspecialodd%
\else%
\ebarspecialeven%
\fi%
\else%
\ebarspecialodd%
\fi%
\fi%
}%
%
% genebaronpage
%
% Fake ebar on for page begin
%
%
\def\genebaronpage{%
\ifeof\ebarin%
\else%
\special{ps:%
/GENEBARONPAGE pop % FOR DEBUGGING PostScript
}%
\ebarspecialstart%
%
\if@twoside%
\ifodd\count0%
\ebarspecialodd%
\else%
\ebarspecialeven%
\fi%
\else%
\ebarspecialodd%
\fi%
\fi%
}%
%
% genebaroff
%
% Writes the relative page number to the ebar output file, and
% generates special code for end
%
% Place where the ebar will occur
%
\def\genebaroff{\write\ebarout{\the\count0}%
\ifeof\ebarin%
\else%
\global\ebarsubtract=0 %
\global\advance\ebarnest by -1 %
%
\ifnum\ebarnest=0 %
\else%
\@latexerr{Edit bar are nested, bad results can occur.}%
{Please use genebaron before using genebaroff}%
\fi%
%
\special{ps:%
/GENEBAROFF pop % FOR DEBUGGING PostScript
}%
\ebarspecialend%
\fi%
}%
%
% genebaroffpage
%
% Fake ebar off for page end
%
\def\genebaroffpage{%
\ifeof\ebarin%
\else%
\global\ebarsubtract=\pagegoal % Get pagegoal
\ifdim\truepagetotal < \pagegoal %
\global\advance\ebarsubtract by -\truepagetotal % subtract truepagetotal
\else
\global\advance\ebarsubtract by -\pagegoal % subtract pagegoal
\fi
%
\global\divide\ebarsubtract by 65536 % Divide by scaled points
%
\special{ps:%
/GENEBAROFFPAGE pop % FOR DEBUGGING PostScript
}%
\ebarspecialend%
\fi%
}%
%
%
\globaldefs0%
%
% Sample shipout routine changes
%
\def\@outputpage{\begingroup\catcode`\ =10
\let\-\@dischyph \let\'\@acci \let\`\@accii \let\=\@acciii
\if@specialpage
\global\@specialpagefalse\@nameuse{ps@\@specialstyle}\fi
\if@twoside
\ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
\let\@themargin\oddsidemargin
\else \let\@thehead\@evenhead
\let\@thefoot\@evenfoot \let\@themargin\evensidemargin
\fi\fi
%
{\setbox0=\vbox{\unvcopy\@outputbox} % MRV 07JAN94
\global\truepagetotal=\ht0} % Get true page total
%
\shipout
\vbox{\normalsize \baselineskip\z@ \lineskip\z@
\let\par\@@par %% 15 Sep 87
\vskip \topmargin \moveright\@themargin
\vbox{\setbox\@tempboxa
\vbox to\headheight{\vfil \hbox to\textwidth
{\let\label\@gobble \let\index\@gobble
\@thehead}} %% 22 Feb 87
\dp\@tempboxa\z@
\box\@tempboxa
\vskip \headsep
%
\box\@outputbox
%
\endebarthispage%
%
\baselineskip\footskip
\hbox to\textwidth{\let\label\@gobble
\let\index\@gobble %% 22 Feb 87
\@thefoot}}}\global\@colht\textheight
\endgroup\stepcounter{page}\let\firstmark\botmark%
%
\beginebarnextpage{}}
|