-
Notifications
You must be signed in to change notification settings - Fork 7
/
trackchanges.sty
934 lines (858 loc) · 26.2 KB
/
trackchanges.sty
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
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
%%
%% This file is part of TrackChanges
%% Copyright 2006-2009
%% Novimir Antoniuk Pablant <[email protected]>
%% Felix Salfner <[email protected]>
%%
%% http://trackchanges.sourceforge.net/
%%
%% Portions of this code adapted from the 'soul' package.
%% Copyright (C) 1998-2003 Melchior FRANZ
%%
%% TrackChanges is free software: you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation, either version 2 of the License, or
%% (at your option) any later version.
%%
%% TrackChanges is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with TrackChanges. If not, see <http://www.gnu.org/licenses/>.
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% trackchanges.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% A graphical interface has been written to allow the changes made
%% using this style file to be interactively accepted, rejected
%% or changed.
%% trackchanges.py
%%
%% To find the latest versions this latex style file and the
%% associated files file go to:
%% http://trackchanges.sourceforge.net/
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Usage:
%%
%% Help files are included as part of this package:
%% ./documentation/web/html_css/help.html
%%
%% TrackChanges adds the following 5 commands to allow for collaborative
%% editing of LaTeX documents.
%%
%% \add[editor]{text to add}
%% \remove[editor]{text to remove}
%% \change[editor]{text to remove}{text to add}
%% \annote[editor]{text to annotate}{note}
%% \note[editor]{note}
%%
%% In all cases 'editor' is optional.
%%
%% In order to have comments color coded by editor, the editors must
%% be added in the preamble.
%%
%% \addeditor{editor}
%%
%%
%% Options
%%
%% There are 5 display options. These are specified with the
%% \usepackage[options]{trackchanges)
%%
%% finalold
%% Ignore all of the edits.
%% The document will look as if the edits had not been added.
%% finalnew
%% Accept all of the edits.
%% Notes will not be shown in the final output.
%% footnotes
%% Added text will be shown inline. Removed text and notes
%% will be shown as footnotes.
%% This is the default option.
%% margins
%% Added text will be shown inline. Removed text and notes
%% will be shown in the margin.
%% Margin notes will be aligned with the edits when possible.
%% inline
%% All edits will be shown inline.
%%
%% The following two options are to be used with the 'margins'
%% display style. They are used to make more space for the margin
%% notes. By default the margins are left as in the original
%% document.
%%
%% movemargins
%% Move the text over to the left hand side.
%% The textwidth will stay the same.
%% adjustmargins
%% Reduce the textwidth and move the text over to the left
%% hand side.This option will produced the most space for
%% the margin notes.
%%
%%
%% Advanced Usage
%%
%% Certain types of commands cannot be used inside of the TrackChanges
%% edit commands without special handling. For more details see
%% the limitations section.
%%
%% This option can be used to deal with incompatible commands.
%%
%% ignoremode
%%
%% Additional commands can be added to the ignore list with the
%% following command.
%%
%% \tcignore{<command name>}{<num args>}{<arg num to pass>}
%%
%% The last argument specifies which, if any, arguments to pass
%% as plain text when the command is ignored. If the last
%% argument is zero, then all of the arguments will be ignored.
%% If \color and \textcolor were not already on the ignore
%% list then the following commands could be used to add them:
%%
%% \tcignore{\textcolor}{2}{2}
%% \tcignore{\color}{1}{0}
%%
%%
%% TrackChanges also requires special handling for font changing
%% commands. These type of commands may have to be registered
%% with track changes to be dealt with properly. To register a
%% new command use the following command.
%%
%% \tcregister{<command name>}{<num args>}
%%
%% All of the standard font switching command are registered by
%% default. If \bf and \emph were not already registered then
%% the following commands could be used to add them:
%%
%% \tcregister{\bf}{0}
%% \tcregister{\emph}{1}
%%
%% While register commands is primarily for font changing it may
%% work for other types of commands that are causing problems.
%%
%%
%%
%% Limitations
%%
%% - If another package is used that adjusts the margins, it
%% can take precedence over the TrackChanges handling.
%% To make sure TrackChanges has the last word, load it
%% after all other margin related packages.
%%
%% - Incompatable with the package 'ulem'
%% Use the package 'soul' instead for underlining/strikeout.
%%
%% - TrackChanges cannot handle certain kinds of commands inside
%% the edit commands. In particular \color, \textcolor and
%% any commands from the underlining package 'soul' will not work.
%% There are two ways to get around these issues.
%% 1. The 'ignoremode' option can be used.
%% This will tell TrackChanges to ignore certain commands
%% (Including the ones mentioned above).
%% Additional commands can be added to the ignore list with
%% the \tcignore command.
%% 2. Sometimes the problematic commands can be preceded by
%% \protect. This however can have strange behavior.
%%
%% - TrackChanges requires special handling for certain kinds of
%% commands inside of edit commands. These problematic commands
%% are generally font switching commands. All of the common
%% font switching commands (such as \emph, \textbf, etc.)
%% are already handled. If you run into an issue you can try
%% using \tcregister to register the problematic command.
%%
%% - No easy way to tell TrackChanges not to split footnotes
%% across multiple pages.
%%
%% - Some other packages that take over footnote handling may be
%% incompatible with TrackChanges. Using a footnote package
%% such as footmisc may fix these problems.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% trackchanges version 0.6, 2007-06-13
%% written by Felix Salfner
%%
%% trackchanges version 0.7, 2009-03-09
%% rewritten by Novimir Pablant
%%
%% version 0.7.0, 2009-04-22 - Novimir Pablant
%% Overhauled how the editors are set up. Now each editor can be
%% added simply by using the /addeditor{name} command.
%% Color system completely overhauled, now uses the 'soul' package.
%% Added margin commands 'movemargins' and 'adjustmargins'.
%% Added an option ignoremode and a reimplementation of portions
%% of 'soul' to allow commands to be ignored inside edits.
%% Commands \tcignore and \tcregister were added.
%% Added depreciation warnings for TrackChanges v0.6 commands.
%% Numerous other internal changes.
%%
%%
%% version 0.7.1 2015-10-20 - Johannes Niediek
%% Added two simple lines to ensure the \thefootnote command is
%% restored after each note, so that regular footnotes and editing
%% footnotes interfer less
%%
%% version 0.7.2 2015-11-07 - Johannes Niediek
%% Changed from soul to soulutf8, to be able to use \usepackage[utf8]{inputenc}
%%
%% version 0.7.0-mfo3 2023-03-10 - Helmut Kastenholz
%% Changed back to soul, which now comprises soulutf8
%% ---------------------------------------------------------------------
%% To do:
%% - Add ability to set custom colors.
%%
%% - Create a better way of adding editors that does not have a
%% five editor limit.
%%
%% - Check if the package 'ulem' is loaded, and issue an error.
%% Right now I am checking if the \ulem command exists.
%% and issuing a warning.
%%
%% - Better error handling, error messages.
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{trackchanges}
[2023/03/10 v0.7.0-mfo3 TrackChanges file ]
% Setup the required packages.
\RequirePackage{color}
\RequirePackage{ifthen}
\RequirePackage{calc}
\RequirePackage{soul}
\RequirePackage{morefloats}
% I ran into some conflicts with other packages that deal
% with footnotes. Adding footmisc solved those problems for me.
%\RequirePackage{footmisc}
%\RequirePackage{manyfoot}
%%
%% -------------- Setup the options
\newif\if@trackchanges
\@trackchangestrue
\newif\if@trackinmargins
\@trackinmarginsfalse
\newif\if@trackinline
\@trackinlinefalse
\newif\if@keepnew
\@keepnewfalse
\newif\if@movemargins
\@movemarginsfalse
\newif\if@adjustmargins
\@adjustmarginsfalse
\newif\if@TCignoremode
\@TCignoremodefalse
\DeclareOption{finalold}{\@trackchangesfalse\@keepnewfalse}
\DeclareOption{finalnew}{\@trackchangesfalse\@keepnewtrue}
\DeclareOption{margins}{\@trackchangestrue\@trackinmarginstrue\@trackinlinefalse}
\DeclareOption{inline}{\@trackchangestrue\@trackinlinetrue\@trackinmarginsfalse}
\DeclareOption{footnotes}{\@trackchangestrue\@trackinmarginsfalse\@trackinlinefalse}
\DeclareOption{movemargins}{\@movemarginstrue\@adjustmarginsfalse}
\DeclareOption{adjustmargins}{\@adjustmarginstrue\@movemarginstrue}
\DeclareOption{ignoremode}{\@TCignoremodetrue}
\DeclareOption{ignoremodeoff}{\@TCignoremodefalse}
%% This option exists for backwards compatibility with v0.6.
%% A depreciated warning will be displayed.
\DeclareOption{final}{\@trackchangesfalse\@keepnewfalse
\PackageWarningNoLine{trackchanges}{%
Option 'final' is depreciated.\MessageBreak%
Use 'finalold' instead%
}%
}
\ProcessOptions
%%
%% -------------- Inhibit footnotes getting split across pages
%% This will inhibit splitting completely.
%% LaTeX will complain about `Underfull \vbox' unless
%% \raggedbottom is also used.
%
%\interfootnotelinepenalty=10000
%
%% Default value is 100.
%%
%% -------------- Set options for the soul package
\setstcolor{red}
\setuloverlap{0pt}
%%
%% -------------- Make an alias to the 'soulregister' command.
\let\tcregister\soulregister
%% -------------- Setup new macros for the soul package.
%% Here we setup two new commands using soul package macros.
%% These will allow strikeout, and underline with colored
%% text. These are important as they ensure that color is
%% maintained even in situations such as a footnote getting
%% split across pages.
%% This is where the color is actually added.
\def\SOUL@coloreverysyllable{%
\SOUL@textcolor{\the\SOUL@syllable%
\SOUL@setkern\SOUL@charkern%
}%
}
%% This is where the color is actually added.
\def\SOUL@ulcoloreverysyllable{%
\SOUL@textcolor{\SOUL@uleverysyllable}%
}
%% Here we define a new command with the text color.
\def\SOUL@settextcolor#1{%
\def\SOUL@textcolor{\textcolor{#1}}%
}
%% This is the setup command for colored text.
\def\SOUL@colorsetup#1{%
\SOUL@settextcolor{#1}%
\SOUL@setup%
\let\SOUL@everysyllable\SOUL@coloreverysyllable%
}
%% This is the setup command for strikeout with colored text.
\def\SOUL@stcolorsetup#1{%
\SOUL@settextcolor{#1}%
\SOUL@stsetup%
\let\SOUL@everysyllable\SOUL@ulcoloreverysyllable%
}
%% This is the setup command for underline with colored text.
\def\SOUL@ulcolorsetup#1{%
\SOUL@settextcolor{#1}%
\SOUL@ulsetup%
\let\SOUL@everysyllable\SOUL@ulcoloreverysyllable%
}
%% Here I define the new callables.
%% Color with strikeout
\DeclareRobustCommand*{\stcolor}[1]{%
\SOUL@stcolorsetup{#1}%
\SOUL@%
}
%% Color with underline
\DeclareRobustCommand*{\ulcolor}[1]{%
\SOUL@ulcolorsetup{#1}%
\SOUL@%
}
%% Colored text
\DeclareRobustCommand*{\soulcolor}[1]{%
\SOUL@colorsetup{#1}%
\SOUL@%
}
%%
%% -------------- Setup counters
\newcounter{userid}
\setcounter{userid}{-1}
\newcounter{changenumber}
\setcounter{changenumber}{0}
\newcounter{storefootnote}
\newcounter{numeditors}
\setcounter{numeditors}{0}
\newcounter{maxeditors}
\setcounter{maxeditors}{5}
%%
%% ----------- Create commands for five users
\newcommand{\TC@editorOne}{n/n}
\newcommand{\TC@editorTwo}{n/n}
\newcommand{\TC@editorThree}{n/n}
\newcommand{\TC@editorFour}{n/n}
\newcommand{\TC@editorFive}{n/n}
%%
%% ----------- create commands to add an editor.
\newcommand{\addeditor}[1]{
\matchuser{#1}
\ifthenelse{\value{userid} = -1}
{\addNewEditor{#1}}{}
}
\newcommand{\addNewEditor}[1]{
\stepcounter{numeditors}
\setcounter{userid}{\value{numeditors}}
% Check the number of authors.
\ifthenelse{\value{numeditors} > \value{maxeditors}}
{\TC@WarningTooManyEditors}
{}
\ifthenelse{\value{userid} = 1}
{\renewcommand{\TC@editorOne}{#1}}
{\ifthenelse{\value{userid} = 2}
{\renewcommand{\TC@editorTwo}{#1}}
{\ifthenelse{\value{userid} = 3}
{\renewcommand{\TC@editorThree}{#1}}
{\ifthenelse{\value{userid} = 4}
{\renewcommand{\TC@editorFour}{#1}}
{\ifthenelse{\value{userid} = 5}%
{\renewcommand{\TC@editorFive}{#1}}
{}
}
}
}
}
}
%%
%% --------------- define text colors for different users
\newcommand{\usercolor}{%
\ifthenelse{\value{userid} = 0}%
{\definecolor{UserColor}{rgb}{0.33,0.11,0.46}}% Purple
{\ifthenelse{\value{userid} = 1}%
{\definecolor{UserColor}{rgb}{0.1,0.1,0.8}}% Blue
{\ifthenelse{\value{userid} = 2}%
{\definecolor{UserColor}{rgb}{0.0,0.6,0.0}}% Green
{\ifthenelse{\value{userid} = 3}%
{\definecolor{UserColor}{rgb}{0.68,0.17,0.5}}% Magenta
{\ifthenelse{\value{userid} = 4}%
{\definecolor{UserColor}{rgb}{0.13,0.60,0.65}}% Cyan
{\ifthenelse{\value{userid} = 5}%
{\definecolor{UserColor}{rgb}{0.86,0.50,0.12}}% Orange
{\definecolor{UserColor}{rgb}{0.13,0.70,0.50}}% Teal
}%
}%
}%
}%
}%
}
%%
%% -------------- set counter userid according to editor
\newcommand{\matchuser}[1]{%
\ifthenelse{\equal{#1}{}}%
{\setcounter{userid}{0}}%
{\ifthenelse{\equal{#1}{\TC@editorOne}}%
{\setcounter{userid}{1}}%
{\ifthenelse{\equal{#1}{\TC@editorTwo}}%
{\setcounter{userid}{2}}%
{\ifthenelse{\equal{#1}{\TC@editorThree}}%
{\setcounter{userid}{3}}%
{\ifthenelse{\equal{#1}{\TC@editorFour}}%
{\setcounter{userid}{4}}%
{\ifthenelse{\equal{#1}{\TC@editorFive}}%
{\setcounter{userid}{5}}%
{\setcounter{userid}{-1}}%
}%
}%
}%
}%
}%
\usercolor%
}
%% --------------- Setup a command for the user label.
\newcommand{\UserLabel}{}
%%
\newcommand{\GetUserLabel}[1]{%
\ifthenelse{\equal{#1}{}}%
{}%
{\userco{\textit{#1}:}}%
}
%%
%% --------------- define commands to color text.
%% The first command works properly across paragraphs.
%% The second works well with the footnote.
%%
%% The last two use the soul package.
\newcommand{\usertext}[1]{\color{UserColor}{#1}\normalcolor}
\newcommand{\usertextfoot}[1]{\textcolor{UserColor}{#1}}
\newcommand{\userco}[1]{\soulcolor{UserColor}{#1}}
\newcommand{\userst}[1]{\stcolor{UserColor}{#1}}
\newcommand{\userul}[1]{\ulcolor{UserColor}{#1}}
%%
%% --------------- define command for margin text.
\newcommand{\marginText}[2]{%
\renewcommand{\baselinestretch}{0.8}%
\marginpar{\raggedright%
\footnotesize%
\textsuperscript{\thefootnote}%
\UserLabel~#2%
}%
}
%%
%% --------------- This need to be called at the beginning of every command.
\newcommand{\trackingstart}[1]{%
% Set the ignores if the 'ignore' option was set.
\if@TCignoremode%
\TC@SetIgnores%
\fi%
\setcounter{storefootnote}{\value{footnote}}%
\refstepcounter{changenumber}%
\matchuser{#1}%
\ifthenelse{\value{userid} = -1}%
{\TC@WarningUnknownEditor{#1}}%
{}%
\let\oldfootnote\thefootnote%
\renewcommand{\thefootnote}{\usertextfoot{c\arabic{changenumber}}}%
\setulcolor{UserColor}%
\renewcommand{\UserLabel}{\GetUserLabel{#1}}%
}
%%
%% --------------- This need to be called at the end of every command.
\newcommand{\trackingend}{%
\setcounter{footnote}{\value{storefootnote}}%
% Reset the ignores if the 'ignore' option was set.
\if@TCignoremode%
\TC@ResetIgnores%
\fi%
\let\thefootnote\oldfootnote%
}
%%
%% --------------- Define the frontend command: \add
%% usage: \add[Editor]{new text}
\newcommand{\add}[2][]{%
\if@trackchanges%
\trackingstart{#1}%
\if@trackinmargins%
\textsuperscript{\thefootnote}%
\marginText{#1}{\userco{\textit{Text added.}}}%
\else%
\if@trackinline%
{\footnotesize\textsuperscript{\UserLabel}}%
\else%
\footnote{\UserLabel~\userco{\textit{Text added.}}}%
\fi%
\fi%
\usertext{\ul{#2}}%
\trackingend%
\else%
%% if trackchanges is false ...
\if@keepnew%
%% Keep the new text.
#2%
\fi%
%% if keepnew is false do nothing.
\fi%
}
%%
%% --------------- Define the frontend command: \remove
%% usage: \remove[Editor]{original text}
\newcommand{\remove}[2][]{%
\if@trackchanges%
\trackingstart{#1}%
\if@trackinmargins%
\textsuperscript{\thefootnote}%
\marginText{#1}{\userst{#2}}%
\else%
\if@trackinline%
{\footnotesize\textsuperscript{\UserLabel}\usertext{\st{#2}}}%
\else%
\footnote{\UserLabel~\userst{#2}}%
\fi%
\fi%
\trackingend%
\else%
%% if trackchanges is false ...
\if@keepnew%
%% Remove the old text.
\else
%% Keep the old text.
#2%
\fi%
\fi%
}
%%
%% --------------- Define the frontend command: \change
%% usage: \change[Editor]{original text}{new text}
\newcommand{\change}[3][]{%
\if@trackchanges%
\trackingstart{#1}%
\if@trackinmargins%
\textsuperscript{\thefootnote}%
\marginText{#1}{\userst{#2}}%
\else%
\if@trackinline%
{\footnotesize\textsuperscript{\UserLabel}\usertext{\st{#2}}}%
\else%
\footnote{\UserLabel~\userst{#2}}%
\fi%
\fi%
\usertext{\ul{#3}}%
\trackingend%
\else%
%% if trackchanges is false ...
\if@keepnew%
%% Keep the new text.
#3%
\else
%% Keep the old text.
#2%
\fi%
\fi%
}
%%
%% --------------- Define frontend command: \annonte
%% usage: \annote[Editor]{highlighted text}{note text}
\newcommand{\annote}[3][]{%
% Make the underlining thicker and higher.
\setul{1pt}{0.3ex}%
\if@trackchanges%
\trackingstart{#1}%
\if@trackinmargins%
\textsuperscript{\thefootnote}%
\marginText{#1}{\userco{#3}}%
\ul{#2}%
\else%
\if@trackinline%
{\footnotesize\textsuperscript{\UserLabel}}%
\ul{#2}%
{\footnotesize\usertext{~[#3]}}%
\else%
\footnote{\UserLabel~\userco{#3}}%
\ul{#2}%
\fi%
\fi%
\trackingend%
\else%
%% if trackchanges is false ... just print text.
#2%
\fi%
% Reset the underlineing
\resetul%
}
%%
%% --------------- Define frontend command: \note
%% usage: \note[Editor]{note text}
\newcommand{\note}[2][]{%
\if@trackchanges%
\trackingstart{#1}%
\if@trackinmargins%
\textsuperscript{\thefootnote}%
\marginText{#1}{\userco{#2}}%
\else%
\if@trackinline%
{\footnotesize\textsuperscript{\UserLabel}}%
{\footnotesize\usertext{~[#2]}}%
\else%
\footnote{\UserLabel~\userco{#2}}%
\fi%
\fi%
\trackingend%
\else%
%% if trackchanges is false ... do not print notes
\fi%
}
%%
%% --------------- Define frontend command: \refneeded
%% usage: \refneeded[Editor]{note text}
\newcommand{\refneeded}[2][]{%
\if@trackchanges%
\trackingstart{#1}%
\if@trackinmargins%
\textsuperscript{\thefootnote}%
\marginText{#1}{\userco{REFERENCE NEEDED #2}}%
\else%
\if@trackinline%
{\footnotesize\textsuperscript{\UserLabel}}%
\ifthenelse{\equal{#2}{}}%
{{\footnotesize\usertext{~[REFERENCE NEEDED]}}}%
{{\footnotesize\usertext{~[REFERENCE NEEDED #2]}}}%
\else%
\footnote{\UserLabel~\userco{REFERENCE NEEDED #2}}%
\fi%
\fi%
\trackingend%
\else%
%% if trackchanges is false ... do not print notes
\fi%
}
%%
%% -------------- Setup for margin notes.
\newcommand{\setupMarginpar}{
\setlength{\marginparwidth}{\paperwidth}
\addtolength{\marginparwidth}{-1in}
\addtolength{\marginparwidth}{-\oddsidemargin}
\addtolength{\marginparwidth}{-\hoffset}
\addtolength{\marginparwidth}{-\textwidth}
\addtolength{\marginparwidth}{-\marginparsep}
\addtolength{\marginparwidth}{-5mm}
}
\newcommand{\setupMoveMargins}{
\setlength{\oddsidemargin}{-1in}
\addtolength{\oddsidemargin}{0.5in}
}
\newcommand{\setupAdjustMargins}{
\setlength{\textwidth}{0.5\paperwidth}
}
\newcommand{\setupMargins}{
\if@movemargins
\setupMoveMargins{}
\fi
\if@adjustmargins
\setupAdjustMargins{}
\fi
% The Margins are setup using \AtBeginDocument.
}
%% --------------- Check that conflicting packages are not loaded.
\def\TC@checkCompatibility{
\ifx\uline\undefined
\else
\TC@WarningUlem
\fi
}
%% ---------------- Setup for actions to be taken after the style file has been read.
\AtEndOfPackage{
\if@trackchanges
\if@trackinmargins
\setupMargins{}
\else
\fi
\fi
}
%% ---------------- Setup for actions to be taken after the preamble.
\AtBeginDocument{
\TC@checkCompatibility
\TC@checkDepreciated
\if@trackchanges
\if@trackinmargins
\setupMarginpar
\else
\fi
\fi
}
%%
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% --------------- Setup for backwards compatibility with v0.6
\newcommand{\initialsOne}{}
\newcommand{\initialsTwo}{}
\newcommand{\initialsThree}{}
\newcommand{\initialsFour}{}
\newcommand{\initialsFive}{}
%% --------------- Check for depreciated options
\def\TC@checkDepreciated{
\ifthenelse{\equal{\initialsOne}{}}
{}{\TC@WarningDepreciatedInitials
\addeditor{\initialsOne}}
\ifthenelse{\equal{\initialsTwo}{}}
{}{\TC@WarningDepreciatedInitials
\addeditor{\initialsTwo}}
\ifthenelse{\equal{\initialsThree}{}}
{}{\TC@WarningDepreciatedInitials
\addeditor{\initialsThree}}
\ifthenelse{\equal{\initialsFour}{}}
{}{\TC@WarningDepreciatedInitials
\addeditor{\initialsFour}}
\ifthenelse{\equal{\initialsFive}{}}
{}{\TC@WarningDepreciatedInitials
\addeditor{\initialsFive}}
}
%%
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% --------------- Setup warnings.
\newcommand{\TC@WarningTooManyEditors}{%
\PackageWarningNoLine{trackchanges}{%
A maximum of \arabic{maxeditors} editors are supported.\MessageBreak%
Changes made by additional editors will all have\MessageBreak%
the same color coding%
}%
}
\newcommand{\TC@WarningUnknownEditor}[1]{%
\PackageWarning{trackchanges}{%
Editor '#1' unknown.\MessageBreak%
}%
}
\newcommand{\TC@WarningUlem}{%
\PackageWarningNoLine{trackchanges}{%
TrackChanges is not compatable with the \MessageBreak%
'ulem' package.\MessageBreak%
Use the 'soul' package instead%
}%
}
\newcommand{\TC@WarningDepreciatedInitials}{%
\PackageWarningNoLine{trackchanges}{%
The '\noexpand\renewcommand{\noexpand\initialsNum}{name}' commands\MessageBreak%
are depreciated.\MessageBreak%
Use '\noexpand\addeditor{name}' instead.'%
}%
}
%%
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Below are a set of definitions to add an ignore list to the soul
%% package.
%%
%% This is not a default as it reimplements some of the internals of
%% the soul package. If a new version of soul were to come out
%% this stuff might break.
\if@TCignoremode
%% These two function allow us to turn on and off the ignore list.
%% This is so we don't mess up soul for anyone else.
\def\TC@SetIgnores{%
\let\SOUL@ignores\TC@ignores%
}
\def\TC@ResetIgnores{%
\let\SOUL@ignores\TC@emptyignores%
}
\newtoks\TC@ignores
\newtoks\TC@emptyignores
%% The commands are separated by \\. The first number is the
%% number of inputs for the command. The command name
%% is given next. The last number specifies which input to
%% pass through. If the last number is zero nothing will be
%% passed.
\TC@ignores={%
\\2\textcolor{2}%
\\1\color{0}%
\\1\ul{1}%
\\1\st{1}%
\\1\hl{1}%
\\1\caps{1}%
\\1\so{1}%
}
\TC@emptyignores={}
%% Initialize soul not to use the ignore list.
\let\SOUL@ignores\TC@emptyignores
%% This is a way to register new ignores.
\def\tcignore#1#2#3{{%
\edef\x{\global\TC@ignores={\the\TC@ignores
\noexpand\\#2\noexpand#1#3}}\x
}}
%% Here I redefine \SOUL@dotoken.
%% The new version also checks for ignores.
\def\SOUL@dotoken#1{%
\def\SOUL@@{\SOUL@addtoken{#1}}%
\def\\##1##2{%
\edef\SOUL@x{\string#1}%
\edef\SOUL@n{\string##2}%
\ifx\SOUL@x\SOUL@n
\def\SOUL@@{\SOUL@docmd{##1}{#1}}%
\else
\edef\SOUL@n{\string##2\space}%
\ifx\SOUL@x\SOUL@n
\def\SOUL@@{\SOUL@docmd{##1}{#1}}%
\fi
\fi
}%
\the\SOUL@cmds
\def\\##1##2##3{%
\edef\SOUL@x{\string#1}%
\edef\SOUL@n{\string##2}%
\ifx\SOUL@x\SOUL@n
\def\SOUL@@{\SOUL@doignore{##1}{#1}{##3}}%
\else
\edef\SOUL@n{\string##2\space}%
\ifx\SOUL@x\SOUL@n
\def\SOUL@@{\SOUL@doignore{##1}{#1}{##3}}%
\fi
\fi
}%
\the\SOUL@ignores%
\SOUL@@
}
%% This is where the actual ignoring is done.
\def\SOUL@doignore#1#2#3{%
\ifx2#1%
\SOUL@doword%
\def\SOUL@@##1##2{%
\ifx1#3%
\SOUL@do{##1}%
\else\ifx2#3%
\SOUL@do{##2}%
\fi\fi%
\SOUL@scan%
}%
\else\ifx1#1%
\SOUL@doword%
\def\SOUL@@##1{%
\ifx1#3%
\SOUL@do{##1}%
\fi%
\SOUL@scan%
}%
\else
\SOUL@doword
\let\SOUL@@\SOUL@scan
\fi\fi
\SOUL@@
}
\fi
%%
%%
%% End of file trackchanges.sty