summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-12 23:53:15 +0000
committerKarl Berry <karl@freefriends.org>2006-01-12 23:53:15 +0000
commit316b0cc56635cdf518c2f1b5fdb4023047590420 (patch)
tree2d807059f3edf259d7c2013c416bdc9398f004d5
parent1d1db4f19babf48af1a41b9e0f33d5aa5a13f6df (diff)
cmdtrack
git-svn-id: svn://tug.org/texlive/trunk@770 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/tex/latex/cmdtrack/cmdtrack.sty218
1 files changed, 218 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/cmdtrack/cmdtrack.sty b/Master/texmf-dist/tex/latex/cmdtrack/cmdtrack.sty
new file mode 100644
index 00000000000..9c2fe9021d9
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/cmdtrack/cmdtrack.sty
@@ -0,0 +1,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'.