blob: 0d79e6909451f416d9cdaa1082de6e733e702620 (
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
|
%
% Execute this TeX file with
% latex -interaction=batchmode commands-check
%
% The package loaded and the commands checked can be customised:
\providecommand\PKG{expl3}
\providecommand\CMDS{commands-check.cmds}
\documentclass{minimal}
\usepackage{\PKG}
\makeatletter
% "loop...if...then...repeat" from TeX by Topic:
\def\cmdchk@loop#1\cmdchk@repeat{\def\cmdchk@body{#1}\cmdchk@iterate}
\def\cmdchk@iterate{%
\let\cmdchk@next\relax
\cmdchk@body \let\cmdchk@next\cmdchk@iterate \fi \cmdchk@next}
\let \@tempb \@empty
\newread \cmdchk@read
\openin \cmdchk@read \CMDS \relax
\def\checkcmds{%
\begingroup
\catcode`\\=12
\endlinechar=-1
\loop
\read \cmdchk@read to \@tempa \relax
\ifx \@tempa \@empty
\closein \cmdchk@read
\else
\ifcsname \expandafter \@gobble \@tempa \endcsname
\else
\xdef \@tempb {\@tempb ^^J!>\space\space\space\space\@tempa}
\fi
\repeat
\endgroup
\ifx\@tempb\@empty\else
\nonstopmode
\errmessage{\@tempb^^J}
\batchmode
\fi
}
\makeatother
\begin{document}
\checkcmds
\end{document}
|