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
|
%%
%% This is file `cmdtrack.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% cmdtrack.dtx
%%
%%% ====================================================================
%%% @LaTeX-file{
%%% filename = "cmdtrack.sty",
%%% version = "1.05",
%%% date = "1999/07/22",
%%% time = "18:12:25 EDT",
%%% author = "Michael John Downes",
%%% email = "mjd@ams.org",
%%% copyright = "Copyright 1999 Michael John Downes.
%%% This program may be used, distributed, or
%%% even sold, without restrictions.",
%%% }
%%% ====================================================================
%% Self-documenting section
\ifcat ?$\relax{\catcode37=7 \catcode127=9 \def\0{\@sanitize\catcode}\fi
%%? \endlinechar125\catcode127=13\def%%?{\typeout}\037=7
%%?{====================================================================
%%?{ With the cmdtrack package, all commands and environments defined
%%?{ between \usepackage{cmdtrack} and \begin{document} will be marked
%%?{ for logging. A report on the usage of the marked commands will be
%%?{ printed in the LaTeX log file. Standard LaTeX methods must be used
%%?{ for defining the commands (things defined with \def, for example,
%%?{ won't be logged). Use \untrack{\cmd,\othercmd,...} just before
%%?{ \begin{document} to turn off tracking for selected commands.
%%?{
%%?{ Package options:
%%?{
%%?{ ? Causes this information to be shown on-screen.
%%?{
%%?{ morose Opposite of verbose: causes the brief message about the ?
%%?{ option to be suppressed.
%%?{
%%?{ Support for the following is not [yet] provided:
%%?{ \DeclareTextSymbol, \DeclareMathRadical, \DeclareMathAlphabet, and
%%?{ some others.
%%?{
%%?{ More comprehensive documentation for cmdtrack.sty may be found in
%%?{ cmdtrack.dtx.
%%?{====================================================================
%%?{}}\endinput\bgroup
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cmdtrack}[1999/07/22 v1.05]
\let\commandlist\@empty
\AtEndDocument{\report@command@usage}
\edef\@quotechar{\string"}
\newcommand{\untrack}[1]{%
\begingroup
\def\logcmd##1##2{\global\let##1=##2%
\xdef##2{\@percentchar\the\inputlineno}%
}%
\untrack@a#1{,\@gobble}\endgroup
}
\def\untrack@a#1{%
\ifx,#1\@gobbletwo\expandafter\@gobble
\else \expandafter\untrack@b\meaning#1\@nil#1%
\fi
\untrack@a
}
\def\untrack@b#1->#2#3#4#5#6#7#8#9\@nil{%
\expandafter\ifx\csname #3#4#5@#6#7#8\endcsname\log@cmd
\else
\def\@tempa##1{%
\PackageWarningNoLine{cmdtrack}{%
Command \protect##1 does not have tracking turned on}%
}%
\expandafter\@tempa
\fi
}
\def\@isreserved@a#1\reserved@a#2#3@{#2}
\let\@hash@\relax
\def\log@cmd#1#2{%
\if\@isreserved@a#2T\reserved@a F@T%
\endgroup
\else
\toks@\expandafter{\commandlist#1}%
\xdef\commandlist{\the\toks@}%
\endgroup
\def#2{\logcmd#2#1}%
\fi
\let\@hash@##%
\l@ngrel@x\expandafter\def\expandafter#1\reserved@a
}
\def\logcmd#1#2{%
\ifx\protect\@typeset@protect
\global\let#1#2%
\xdef#2{\@percentchar\the\inputlineno}%
\else
\expandafter\protect
\fi
#1%
}
\begingroup \catcode`\"=12
\gdef\cmd@check#1->#2#3-#4\@nil#5{%
\if\@percentchar#2\typeout{\string#5" was used on line #3}%
\else\typeout{\string#5" was never used}%
\fi
}
\endgroup
\def\report@command@usage{%
\def\@tempa{\typeout{=========================================}}%
\@tempa
\begingroup \escapechar\m@ne
\def\do##1{%
\ifx\advance##1\expandafter\@gobbletwo\fi
{\expandafter\cmd@check\meaning##1->@-\@nil##1}%
\do
}%
\expandafter\do\commandlist \advance\z@\z@
\endgroup
\@tempa
}
\def\testthm#1{%
\expandafter\testthm@a\csname#1\expandafter\endcsname
\csname\@quotechar#1\endcsname
}
\let\old@newtheorem\newtheorem
\def\newtheorem#1{%
\AtBeginDocument{\testthm{#1}}%
\old@newtheorem{#1}%
}
\def\testthm@a#1#2{%
\begingroup
\toks@\expandafter{\commandlist#2}%
\xdef\commandlist{\the\toks@}%
\endgroup
\let#2#1%
\def#1{\logcmd#1#2}%
}
\def\set@mathchar#1#2#3#4{%
\expandafter\set@mathchar@a
\csname\@quotechar math character \string#2\expandafter\endcsname
\expandafter{\number`#2}{#1}{#3}{#4}%
}%
\def\set@mathchar@a#1#2#3#4#5{%
\global\mathcode#2=\@quotechar 8000
\global\mathchardef#1\@quotechar\mathchar@type#4\hexnumber@#3#5\relax
\toks@\expandafter{\commandlist#1}%
\xdef\commandlist{\the\toks@}%
\begingroup \lccode`\.=#2\lccode`\~=#2\lowercase{\endgroup
\gdef~{\global\mathcode#2=#1\logcmd#1#1}}%
}
\def\set@mathsymbol#1#2#3#4{%
\begingroup \escapechar=`\"\relax
\global\expandafter\mathchardef
\csname\string#2\endcsname
\@quotechar\mathchar@type#3\hexnumber@#1#4\relax
\expandafter\log@cmd@a\csname\string#2\endcsname#2%
}
\def\set@mathaccent#1#2#3#4{%
\xdef#2{\mathaccent\@quotechar\mathchar@type#3\hexnumber@#1#4\relax}%
\begingroup \escapechar`\"\relax
\expandafter\log@cmd@a\csname\string#2\endcsname#2%
}
\def\log@cmd@a#1#2{%
\toks@\expandafter{\commandlist#1}%
\xdef\commandlist{\the\toks@}%
\endgroup
\gdef#2{\logcmd#2#1}%
}
\DeclareOption{?}{\AtEndOfPackage{\ShowPackageInfo{cmdtrack}}}
\DeclareOption{morose}{}
\DeclareOption{simple}{%
\def\logcmd#1#2{%
\ifx\protect\@typeset@protect
\global\let#1#2%
\begingroup \escapechar\m@ne
\typeout{\string#2\string" was used on line \the\inputlineno}%
\endgroup
\else
\expandafter\protect
\fi
#1%
}%
\AtBeginDocument{\global\let\commandlist\@empty}%
\global\let\report@command@usage\relax
}
\ProcessOptions\relax
\begingroup
\catcode`\%=9 \catcode`\&=14 \catcode`\"=12
\@ifpackagewith{cmdtrack}{morose}{\catcode`\%=14 }{}
\@ifpackagewith{cmdtrack}{?}{\catcode`\%=14 }{}
%%\typeout{&
%%Try "\string\usepackage[\string ?]{cmdtrack}"
%%to see information on using this package^^J&
%%[including how to turn off this "helpful" message].&
%%}
\endgroup
\newcommand{\ShowPackageInfo}[1]{%
\begingroup \catcode`\?=3
\input{#1.\@pkgextension}%
\endgroup
}
\let\@@yargdef\@yargdef
\AtBeginDocument{\let\@yargdef\@@yargdef}
\let\@hash@\relax
\def\@yargdef #1#2#3{%
\@tempcnta#3\relax \advance\@tempcnta\@ne \let\@hash@\relax
\edef\reserved@a{\ifx#2\tw@ [\@hash@ 1]\fi}%
\@tempcntb#2%
\@whilenum\@tempcntb<\@tempcnta\do{%
\edef\reserved@a{\reserved@a\@hash@\the\@tempcntb}%
\advance\@tempcntb\@ne
}%
\begingroup \escapechar=`\"\relax
\expandafter\log@cmd\csname\string#1\endcsname#1%
}
\endinput
%%
%% End of file `cmdtrack.sty'.
|