summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/color-edits/color-edits.sty
blob: 7c507bfd4a6b3ed60f8cc7c826103e4274f5eee1 (plain)
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
%%
%% This is file `color-edits.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% color-edits.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2020 by David Kempe
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version.  The latest version of this license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
 \ProvidesPackage{color-edits}[2020/09/18 v1.1 Class for annotating authors' edits in color]
\def\coloredits@SuppressEdits{no}
\DeclareOption{suppress}{\def\coloredits@SuppressEdits{yes}}
\def\coloredits@ShowDeletions{no}
\DeclareOption{showdeletions}{\def\coloredits@ShowDeletions{yes}}
\ProcessOptions\relax
    % \CharacterTable
    %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
    %   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
    %   Digits        \0\1\2\3\4\5\6\7\8\9
    %   Exclamation   \!     Double quote  \"     Hash (number) \#
    %   Dollar        \$     Percent       \%     Ampersand     \&
    %   Acute accent  \'     Left paren    \(     Right paren   \)
    %   Asterisk      \*     Plus          \+     Comma         \,
    %   Minus         \-     Point         \.     Solidus       \/
    %   Colon         \:     Semicolon     \;     Less than     \<
    %   Equals        \=     Greater than  \>     Question mark \?
    %   Commercial at \@     Left bracket  \[     Backslash     \\
    %   Right bracket \]     Circumflex    \^     Underscore    \_
    %   Grave accent  \`     Left brace    \{     Vertical bar  \|
    %   Right brace   \}     Tilde         \~}
\RequirePackage{ifthen}
\RequirePackage{color}

\definecolor{@gray}{rgb}{0.5,0.5,0.5}

\newcommand{\coloredits@addauthoredit}[3]{%
\ifthenelse{\equal{\coloredits@SuppressEdits}{yes} \or \equal{#2}{suppress}}{% suppressed
\expandafter\long\expandafter\def\csname #1edit\endcsname ##1{##1}%
}{% not suppressed
\expandafter\long\expandafter\def\csname #1edit\endcsname ##1{{\color{#3}##1}}
}}

\newcommand{\coloredits@addauthorreplace}[3]{%
\ifthenelse{\equal{\coloredits@SuppressEdits}{yes} \or \equal{#2}{suppress}}{% suppressed
\expandafter\long\expandafter\def\csname #1replace\endcsname ##1##2{##2}
}{% not suppressed
\ifthenelse{\equal{\coloredits@ShowDeletions}{yes}}{% Showing deletions
\expandafter\long\expandafter\def\csname #1replace\endcsname ##1##2{%
{\color{@gray}##1}{\color{#3}##2}}
}{% Not showing deletions
\expandafter\long\expandafter\def\csname #1replace\endcsname ##1##2{%
{\color{#3}##2}}
}%
}}

\newcommand{\coloredits@addauthorcomment}[3]{%
\ifthenelse{\equal{\coloredits@SuppressEdits}{yes} \or \equal{#2}{suppress}}{% suppressed
\expandafter\long\expandafter\def\csname #1comment\endcsname ##1{}
}{% not suppressed
\expandafter\long\expandafter\def\csname #1comment\endcsname ##1{%
{\color{#3}[#2: ##1]}}
}}

\newcommand{\coloredits@addauthormargincomment}[3]{%
\ifthenelse{\equal{\coloredits@SuppressEdits}{yes} \or \equal{#2}{suppress}}{% suppressed
\expandafter\long\expandafter\def\csname #1margincomment\endcsname ##1{}
}{% not suppressed
\expandafter\long\expandafter\def\csname #1margincomment\endcsname##1{{%
\color{#3}$[\bullet]$\marginpar{\scriptsize\color{#3}[#2: ##1]}}}
}}

\newcommand{\coloredits@addauthordelete}[3]{%
\ifthenelse{\equal{\coloredits@SuppressEdits}{yes} \or \equal{#2}{suppress}}{% suppressed
\expandafter\long\expandafter\def\csname #1delete\endcsname ##1{}
}{% not suppressed
\ifthenelse{\equal{\coloredits@ShowDeletions}{yes}}{% Showing deletions
\expandafter\long\expandafter\def\csname #1delete\endcsname ##1{{\color{@gray}##1}}
}{% Not showing deletions
\expandafter\long\expandafter\def\csname #1delete\endcsname ##1{{%
\color{#3}$[\bullet]$\marginpar{\scriptsize\color{#3}#2 deleted here}}}
}%
}}

\newcommand{\coloredits@addauthordeletecomment}[3]{%
\ifthenelse{\equal{\coloredits@SuppressEdits}{yes} \or \equal{#2}{suppress}}{% suppressed
\expandafter\long\expandafter\def\csname #1deletecomment\endcsname ##1##2{}
}{% not suppressed
\ifthenelse{\equal{\coloredits@ShowDeletions}{yes}}{% Showing deletions
\expandafter\long\expandafter\def\csname #1deletecomment\endcsname ##1##2{{%
\color{#3}$[\bullet]$\color{@gray}##2\marginpar{\scriptsize\color{#3}#2: ##1}}}
}{% Not showing deletions
\expandafter\long\expandafter\def\csname #1deletecomment\endcsname ##1##2{{%
\color{#3}$[\bullet]$\marginpar{\scriptsize\color{#3}#2 deleted here: ##1}}}
}%
}}

\newcommand{\addauthor}[3][]{%
\coloredits@addauthoredit{#2}{#1}{#3}
\coloredits@addauthorreplace{#2}{#1}{#3}
\ifthenelse{\equal{#1}{}}{%optional name was not provided
\coloredits@addauthorcomment{#2}{#2}{#3}
\coloredits@addauthormargincomment{#2}{#2}{#3}
\coloredits@addauthordelete{#2}{#2}{#3}
\coloredits@addauthordeletecomment{#2}{#2}{#3}}{%optional name was provided
\coloredits@addauthorcomment{#2}{#1}{#3}
\coloredits@addauthormargincomment{#2}{#1}{#3}
\coloredits@addauthordelete{#2}{#1}{#3}
\coloredits@addauthordeletecomment{#2}{#1}{#3}}
}
\endinput
%%
%% End of file `color-edits.sty'.