[texhax] A Comprehensive list of TeX primitives and Plain TeX macros

Heiko Oberdiek heiko.oberdiek at googlemail.com
Fri Oct 12 02:38:33 CEST 2012


On Thu, Oct 11, 2012 at 10:23:24AM +0100, Philip TAYLOR wrote:

> Heiko Oberdiek wrote:
> 
> >The following Perl script generates a list of command names that are
> >used in plain.tex. The list does not include active characters and
> >primitives that are not used in plain.tex explicitly.
> 
> A brilliant solution, Heiko, and one which I am sure will
> help Paul greatly.  In view of your closing caveat above,
> I wonder if you might be able to write an analous Perl
> script to extract the definitive list from TeX.pool :
> 
> 	http://www.saildart.org/TEX.POO%5BPAS,DEK%5D

tex.pool contains strings. Some of them are command tokens, but
other are not and unhappily these strings are mixed up.

I have added the summary chapters of texbook.tex and
etex_man.tex to get new tokens.

> and then the two lists could be merged ?

Easy.

%%% plaincmds.pl %%%
#!/usr/bin/env perl
use strict;
$^W=1;

my %cmd;

chomp(my $file_plain = `kpsewhich plain.tex`);
my $file_texbook = 'texbook.tex';
my $file_etex = 'etex_man.tex';

sub addcmd ($) {
    my $cmd = shift;
    $cmd{$cmd} = 1;
    return $cmd;
}

open(IN, '<', $file_plain) or die "!!! Error: Cannot open `$file_plain'!\n";
while (<IN>) {
    # s/(^|[^\\])%.*/$1/;
    s/(\\[^a-zA-Z]|\\[a-zA-Z@]+)/addcmd($1)/ge;
    s/\\newif\\if([a-zA-Z@]+)/addcmd("\\$1true");addcmd("\\$1false")/ge;
}
close(IN);

open(IN, '<', $file_texbook) or die "!!! Error: Cannot open
`$file_texbook'!\n"
while (<IN>) {
    last if /beginchapter Chapter 24\./;
}
while (<IN>) {
    last if /beginchapter Chapter 27\./;
    s/\^\|(\\^[a-zA-Z]|\\[a-zA-Z@]+)\|/addcmd($1)/ge;
}
close (IN);

open(IN, '<', $file_etex) or die "!!! Error: Cannot open `$file_etex'!\n";
while (<IN>) {
    last if /\\subsection{Expandable Commands}/;
}
while (<IN>) {
    last if /\\begin{thebibliography}/;
    s/\|(\\[a-zA-Z]+)\|/addcmd($1)/ge;
}
close(IN);

addcmd('\ifcsname');

map { print "$_\n"; } (sort keys %cmd);

__END__
%%% plaincmds.pl %%%

%%% plaincmds.txt %%%
\ 
\!
\"
\#
\$
\%
\&
\'
\(
\)
\*
\+
\,
\-
\.
\/
\:
\;
\<
\=
\>
\?
\@
\@crfalse
\@crtrue
\@midfalse
\@midtrue
\A
\AA
\AE
\Arrowvert
\Big
\Bigg
\Biggl
\Biggm
\Biggr
\Bigl
\Bigm
\Bigr
\Delta
\Downarrow
\Gamma
\H
\Im
\L
\Lambda
\Leftarrow
\Leftrightarrow
\Longleftarrow
\Longleftrightarrow
\Longrightarrow
\O
\OE
\Omega
\Orb
\P
\Phi
\Pi
\Pr
\Psi
\Re
\Relbar
\Rightarrow
\S
\Sigma
\TeX
\TeXXeTstate
\Theta
\Uparrow
\Updownarrow
\Upsilon
\Vert
\Xi
\Z
\[
\\
\]
\^
\_
\`
\a
\aa
\above
\abovedisplayshortskip
\abovedisplayskip
\abovewithdelims
\accent
\active
\acute
\adjdemerits
\advance
\advancepageno
\ae
\afterassignment
\aftergroup
\aleph
\alloc@
\allocationnumber
\allowbreak
\alpha
\amalg
\angle
\approx
\arccos
\arcsin
\arctan
\arg
\arrowvert
\ast
\asymp
\atop
\atopwithdelims
\b
\backslash
\badness
\bar
\baselineskip
\batchmode
\beginL
\beginR
\begingroup
\beginsection
\belowdisplayshortskip
\belowdisplayskip
\beta
\bf
\bffam
\bgroup
\big
\bigbreak
\bigcap
\bigcirc
\bigcup
\bigg
\biggl
\biggm
\biggr
\bigl
\bigm
\bigodot
\bigoplus
\bigotimes
\bigr
\bigskip
\bigskipamount
\bigsqcup
\bigtriangledown
\bigtriangleup
\biguplus
\bigvee
\bigwedge
\binoppenalty
\bmod
\body
\bordermatrix
\bot
\botmark
\botmarks
\bowtie
\box
\boxdef
\boxmaxdepth
\brace
\braceld
\bracelu
\bracerd
\braceru
\bracevert
\brack
\break
\breve
\brokenpenalty
\buildrel
\bullet
\bye
\c
\c at ncel
\cal
\cap
\cases
\catcode
\catcodes
\cdot
\cdotp
\cdots
\centering
\centerline
\ch at ck
\char
\chardef
\check
\chi
\choose
\circ
\cleaders
\cleartabs
\closein
\closeout
\clubpenalties
\clubpenalty
\clubsuit
\colon
\columns
\cong
\coprod
\copy
\copyright
\cos
\cosh
\cot
\coth
\count
\count@
\countdef
\cr
\crcr
\csc
\csname
\cup
\currentgrouplevel
\currentgrouptype
\currentifbranch
\currentiflevel
\currentiftype
\d
\dag
\dagger
\dashv
\day
\ddag
\ddagger
\ddot
\ddots
\deadcycles
\def
\defaulthyphenchar
\defaultskewchar
\deg
\delcode
\delimiter
\delimiterfactor
\delimitershortfall
\delta
\det
\detokenize
\diamond
\diamondsuit
\dim
\dimen
\dimen@
\dimen at i
\dimen at ii
\dimendef
\dimexpr
\discretionary
\displ at y
\displayindent
\displaylimits
\displaylines
\displaystyle
\displaywidowpenalties
\displaywidowpenalty
\displaywidth
\div
\divide
\do
\dospecials
\dosupereject
\dot
\doteq
\dotfill
\dots
\doublehyphendemerits
\downarrow
\downbracefill
\dp
\dt at pfalse
\dt at ptrue
\dump
\eTeXrevision
\eTeXversion
\edef
\egroup
\eject
\ell
\else
\emergencystretch
\empty
\emptyset
\end
\endL
\endR
\endcsname
\endgraf
\endgroup
\endinsert
\endline
\endlinechar
\enskip
\enspace
\epsilon
\eqalign
\eqalignno
\eqno
\equiv
\errhelp
\errmessage
\errorcontextlines
\errorstopmode
\escapechar
\eta
\everycr
\everydisplay
\everyeof
\everyhbox
\everyjob
\everymath
\everypar
\everyvbox
\exhyphenpenalty
\exists
\exp
\expandafter
\f@@t
\f at t
\fam
\fi
\filbreak
\finalhyphendemerits
\finph at nt
\finsm at sh
\firstmark
\firstmarks
\fivebf
\fivei
\fiverm
\fivesy
\flat
\floatingpenalty
\fmtname
\fmtversion
\fo at t
\folio
\font
\fontchardp
\fontcharht
\fontcharic
\fontcharwd
\fontdimen
\foo
\foofalse
\footins
\footline
\footnote
\footnoterule
\footrue
\footstrut
\forall
\frenchspacing
\frown
\futurelet
\gamma
\gcd
\gdef
\ge
\geq
\getf at ctor
\gets
\gg
\global
\globaldefs
\glueexpr
\glueshrink
\glueshrinkorder
\gluestretch
\gluestretchorder
\gluetomu
\goodbreak
\grave
\h at false
\h at true
\halign
\hang
\hangafter
\hangindent
\hat
\hbadness
\hbar
\hbox
\headline
\heartsuit
\hfil
\hfill
\hfilneg
\hfuzz
\hgl@
\hglue
\hideskip
\hidewidth
\hoffset
\holdinginserts
\hom
\hookleftarrow
\hookrightarrow
\hphantom
\hrule
\hrulefill
\hsize
\hskip
\hss
\ht
\hyphenation
\hyphenchar
\hyphenpenalty
\i
\ialign
\if
\if@
\if at cr
\if at mid
\ifcase
\ifcat
\ifcsname
\ifdefined
\ifdim
\ifdt at p
\iff
\iffalse
\iffontchar
\iffoo
\ifh@
\ifhmode
\ifmmode
\ifnum
\ifp at ge
\ifr at ggedbottom
\iftrue
\ifus@
\ifv@
\ifvoid
\ifx
\ignorespaces
\imath
\immediate
\in
\indent
\inf
\infty
\input
\inputlineno
\insc at unt
\insert
\insertpenalties
\int
\interactionmode
\interdisplaylinepenalty
\interfootnotelinepenalty
\interlinepenalties
\interlinepenalty
\intop
\iota
\it
\item
\itemitem
\iterate
\itfam
\j
\jmath
\jobname
\joinrel
\jot
\kappa
\ker
\kern
\l
\lambda
\land
\langle
\language
\lastbox
\lastkern
\lastlinefit
\lastnodetype
\lastpenalty
\lastskip
\lbrace
\lbrack
\lccode
\lceil
\ldotp
\ldots
\le
\leaders
\leavevmode
\left
\leftarrow
\leftarrowfill
\leftharpoondown
\leftharpoonup
\lefthyphenmin
\leftline
\leftrightarrow
\leftskip
\leq
\leqalignno
\leqno
\let
\lfloor
\lg
\lgroup
\lhook
\lim
\liminf
\limits
\limsup
\line
\linepenalty
\lineskip
\lineskiplimit
\ll
\llap
\lmoustache
\ln
\lnot
\log
\loggingall
\long
\longleftarrow
\longleftrightarrow
\longmapsto
\longrightarrow
\loop
\looseness
\lor
\lower
\lowercase
\lq
\m at g
\m at ketabbox
\m at ne
\m at th
\mag
\magnification
\magstep
\magstephalf
\makefootline
\makeheadline
\makeph at nt
\makesm at sh
\mapsto
\mapstochar
\mark
\marks
\mathaccent
\mathbin
\mathchar
\mathchardef
\mathchoice
\mathclose
\mathcode
\mathhexbox
\mathinner
\mathop
\mathopen
\mathord
\mathpalette
\mathph at nt
\mathrel
\mathsm at sh
\mathstrut
\mathsurround
\matrix
\max
\maxdeadcycles
\maxdepth
\maxdimen
\meaning
\medbreak
\medmuskip
\medskip
\medskipamount
\message
\mid
\middle
\midinsert
\min
\mit
\mkern
\models
\month
\moveleft
\moveright
\mp
\mscount
\mskip
\mu
\muexpr
\multiply
\multispan
\muskip
\muskipdef
\mutoglue
\n at space
\nabla
\narrower
\natural
\ne
\nearrow
\neg
\negthinspace
\neq
\newbox
\newcount
\newdimen
\newfam
\newhelp
\newif
\newinsert
\newlanguage
\newlinechar
\newmuskip
\newread
\newskip
\newtoks
\newwrite
\next
\ni
\ninerm
\noalign
\noboundary
\nobreak
\noexpand
\noindent
\nointerlineskip
\nolimits
\nonfrenchspacing
\nonscript
\nonstopmode
\nopagenumbers
\normalbaselines
\normalbaselineskip
\normalbottom
\normallineskip
\normallineskiplimit
\not
\notin
\nu
\null
\nulldelimiterspace
\nullfont
\number
\numexpr
\nwarrow
\nxt
\o
\o at lign
\oalign
\obeylines
\obeyspaces
\odot
\oe
\of
\offinterlineskip
\oint
\ointop
\oldstyle
\omega
\ominus
\omit
\ooalign
\openin
\openout
\openup
\oplus
\or
\oslash
\otimes
\outer
\output
\outputpenalty
\over
\overbrace
\overfullrule
\overleftarrow
\overrightarrow
\overwithdelims
\owns
\p@
\p at gefalse
\p at getrue
\p at renwd
\pagebody
\pagecontents
\pagedepth
\pagediscards
\pagefilllstretch
\pagefillstretch
\pagefilstretch
\pagegoal
\pageinsert
\pageno
\pageshrink
\pagestretch
\pagetotal
\par
\parallel
\parfillskip
\parindent
\parshape
\parshapedimen
\parshapeindent
\parshapelength
\parskip
\partial
\patterns
\pausing
\penalty
\perp
\ph at nt
\phantom
\phi
\pi
\plainoutput
\pm
\pmatrix
\pmod
\postdisplaypenalty
\pr@@@s
\pr@@@t
\pr at m@s
\prec
\preceq
\predisplaydirection
\predisplaypenalty
\predisplaysize
\preloaded
\pretolerance
\prevdepth
\prevgraf
\prim at s
\prime
\proclaim
\prod
\propto
\protected
\psi
\qquad
\quad
\r@@t
\r at ggedbottomfalse
\r at ggedbottomtrue
\radical
\raggedbottom
\raggedright
\raise
\rangle
\rbrace
\rbrack
\rceil
\read
\readline
\relax
\relbar
\relpenalty
\removelastskip
\repeat
\rfloor
\rgroup
\rho
\rhook
\right
\rightarrow
\rightarrowfill
\rightharpoondown
\rightharpoonup
\righthyphenmin
\rightleftharpoons
\rightline
\rightskip
\rlap
\rlh@
\rm
\rmoustache
\romannumeral
\root
\rootbox
\rq
\s at tcols
\s at tt@b
\savinghyphcodes
\savingvdiscards
\sb
\scantokens
\scriptfont
\scriptscriptfont
\scriptscriptstyle
\scriptspace
\scriptstyle
\scrollmode
\searrow
\sec
\setbox
\setlanguage
\setminus
\sett at b
\settabs
\sevenbf
\seveni
\sevenrm
\sevensy
\sfcode
\sh at ft
\sharp
\shipout
\show
\showbox
\showboxbreadth
\showboxdepth
\showgroups
\showhyphens
\showifs
\showlists
\showthe
\showtokens
\sigma
\sim
\simeq
\sin
\sinh
\sixt@@n
\skew
\skewchar
\skip
\skip@
\skipdef
\sl
\slash
\slfam
\smallbreak
\smallint
\smallskip
\smallskipamount
\smash
\smile
\sp
\sp at n
\space
\spacefactor
\spaceskip
\spadesuit
\span
\special
\splitbotmark
\splitbotmarks
\splitdiscards
\splitfirstmark
\splitfirstmarks
\splitmaxdepth
\splittopskip
\sqcap
\sqcup
\sqrt
\sqsubseteq
\sqsupseteq
\ss
\star
\string
\strut
\strutbox
\subset
\subseteq
\succ
\succeq
\sum
\sup
\supereject
\supset
\supseteq
\surd
\swarrow
\t
\t at bb@x
\t at bbox
\tabalign
\tabs
\tabsdone
\tabskip
\tabsyet
\tan
\tanh
\tau
\tenbf
\tenex
\teni
\tenit
\tenrm
\tensl
\tensy
\tentt
\textfont
\textindent
\textstyle
\the
\theta
\thickmuskip
\thinmuskip
\thinspace
\thr@@
\tilde
\time
\times
\to
\toks
\toks@
\toksdef
\tolerance
\top
\topglue
\topins
\topinsert
\topmark
\topmarks
\topskip
\tracingall
\tracingassigns
\tracingcommands
\tracinggroups
\tracingifs
\tracinglostchars
\tracingmacros
\tracingnesting
\tracingonline
\tracingoutput
\tracingpages
\tracingparagraphs
\tracingrestores
\tracingscantokens
\tracingstats
\triangle
\triangleleft
\triangleright
\tt
\ttfam
\ttraggedright
\tw@
\u
\uccode
\uchyph
\undefined
\underbar
\underbrace
\underline
\unexpanded
\unhbox
\unhcopy
\unkern
\unless
\unpenalty
\unskip
\unvbox
\unvcopy
\uparrow
\upbracefill
\updownarrow
\uplus
\uppercase
\upsilon
\us at false
\us at true
\v
\v at false
\v at true
\vadjust
\valign
\varepsilon
\varphi
\varpi
\varrho
\varsigma
\vartheta
\vbadness
\vbox
\vcenter
\vdash
\vdots
\vec
\vee
\vert
\vfil
\vfill
\vfilneg
\vfootnote
\vfuzz
\vgl@
\vglue
\voffset
\voidb at x
\vphantom
\vrule
\vsize
\vskip
\vsplit
\vss
\vtop
\wd
\wedge
\widehat
\widetilde
\widowpenalties
\widowpenalty
\wlog
\wp
\wr
\write
\xdef
\xi
\xspaceskip
\year
\z
\z@
\z at skip
\zeta
\{
\|
\}
\~
%%% plaincmds.txt %%%

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list