[tex-live] texdoc feature idea: LaTeX package macros

Scott Pakin scott at pakin.org
Wed May 19 04:37:17 CEST 2010

I got an idea recently after someone asked on comp.text.tex for
documentation for LaTeX package macros: What if the texdoc database
were set up to map macro names to package documentation?  My
two-second proof of concept was to extract all \DescribeMacro
definitions from the TL2009 source tree and map the macro being
described to the corresponding package name (well, source file without
the extension -- this is a proof of concept, after all):

    $ egrep -r '\\DescribeMacro' /usr/local/stow/texlive-2009/texmf-dist/source/ | perl -ne '/([^:\/]+)\.dtx:\% \\DescribeMacro[{]?\\(\w+)/ && print "[\"\\\\$2\"] = {[\"$1\"]=true,},\n"' | sort -u > macro-map.lua

I then stuck the resulting macro-map.lua file into my cache-tlpdb.lua
file after the other name-to-package mappings.  This let me enter, for

    $ texdoc '\dashgapcolor'

to bring up the arydshln package's documentation.  (Note that 80% of
the maps in macro-map.lua don't actually work; this is a *very* crude

This could be a handy feature to have, especially for new users who
receive a LaTeX document from a colleague and are baffled by all the
macros used in it.

What do you think?

-- Scott

More information about the tex-live mailing list