I've posted this question to comp.text.tex, and they've suggested to
take a look at LuaTeX. So I forwarded the message to the User mailing
list, but probably this one is more appropriate. If not, excuse me!
I'm trying to find *at runtime* all the symbols allowed in a latex
environment. So, given a tex file, I'd like to access
- the complete predefined commands/symbols/definitions;
- the complete list of commands/symbols/definitions defined in packages.
So, the predefined language list would include \LaTeX, \def,
\newcommand, ~, \usepackage, and so on. I've been informed that this is
a naive view, since there are lots of other commands such as \@ and
similars, and a simple match with a \ would be unrealistic (e.g.,
anything beginning with a \ is a command).
When including a package, for example graphicx, I expect to find a way
to have \includegraphics and its siblings. Again, packages may mess up a
The best would be having commands along with their options, but I don't
know if this is possible.
One thing I'd like to avoid: creating my own parser. Why on earth should
I create a parser when latex knows more than me (or everyone else) what
symbols and commands it knows?
The suggestions from the newsgroup is that *maybe* LuaTeX gives a way to
access all TeX's macro hash table. If so, I'd be really happy.
Thanks & Cheers!