I am looking for an editor or documentation browser that can look up all commands from all packages, for eg I want to for 'whiledo' then I want a window or pane to pop up with the required reference information. Also one forgets the command so it would be helpful to type in 'loop commands' and a list of possible commands is displayed.

texdoc does not do this as it requires a package name.

The Perl pod browser works in this way.

  • 1
    Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. – Joseph Wright Mar 17 '12 at 8:57
  • 4
    This is not exactly a question about editors, as it is not up to the (La)TeX editor to manage documentation for packages. Moreover, (La)TeX documentation is simply not in the single format that Perl requires for pod: you are not be able to look at documentation for an arbitrary Perl module using pod, only ones with documentation in the required format. TeX documentation takes a number of forms, and while most is now available as PDF files, the way the sources are set up depends entirely on the person who wrote it. – Joseph Wright Mar 17 '12 at 9:00
  • 5
    there is no such editor – user2478 Mar 17 '12 at 9:13
  • @JosephWright Still, it is a good question. It would be possible to index or \def, \let and similar commands from all macros, at least to make a list of references to the correct packages. Then you can automate the documentation finder and download the correct PDF file if it's not already on the computer. I know, you get plenty of false positives, but there shouldn't be much of such that does not contain @ for start. – yo' Mar 17 '12 at 10:11
  • @tohecz I did not say it was a bad question :-) Indexing is not so straight-forward, I suspect. One of the LaTeX3 concerns is trying to have a more structured approach to document and programming commands, so I not uninterested in this. – Joseph Wright Mar 17 '12 at 10:15

Also not a complete answer, but if you use

find /usr/local/texlive/2011/texmf-dist/source/ -name "*.dtx" -exec grep -q "\\\DescribeMacro{.*whiledo.*}" {} \; -print | xargs -n 1 basename | xargs -n 1 bash -c 'texdoc "${0%.dtx}"'

in a unixoid shell (of course, you should have sources installed and you need to put in the right path to your distribution) the documentation of the ifthen package will pop up.

For regular use you'll wish to make a shell script named, for instance lookuptexdoc.sh containing


find /usr/local/texlive/2011/texmf-dist/source/ -name "*.dtx" -exec grep -Eq "\\\DescribeMacro{.*$1.*}|\\\DescribeEnv{.*$1.*}" {} \; -print | xargs -n 1 basename | xargs -n 1 bash -c 'texdoc "${0%.dtx}"'

Then by calling lookuptexdoc.sh comment you'll get the documentation of all packages defining a command or environment whose name contains "comment".

This can be much refined of course, I'm not a skilled shell programmer by far.


It is not a complete answer, but under linux, it is easily possible to find a .sty file (i.e. package) that contains \def, \edef, \xdef, \gdef or \let followed by the macro name. For example the following shell command sucessfully returns that the macro \linenumbers is defined in the file lineno.sty. Just, you might need to modify number of \ at different places of the shell command depending on your linux settings.

grep -l '\\\(def\|edef\|let\|gdef\|xdef\)\\linenumbers[^a-z@]' \
`find /usr/share/texmf -regex '.*\.sty\|.*\.cls'`

Of course, you might happen to get more positive files, e.g. the command \tag is defined in 4 different files and the macro \reserved@a is defined plenty of times because it is a popular local "macro variable" name.

  • 3
    the problem comes from tex syntax. quite apart from \newcommand \providecommand ... \DeclareRobustCommand, there's the weird usages like \csname and delimited commands and... it's just too much! (i've tried this as a possible help mechanism, and given up because there seems little value in the results i've got.) – wasteofspace Mar 17 '12 at 11:03
  • I know ... There are more commands like these, e.g. \[re][provide]newenvironment. But I think that it needn't be that complicated, most front-end commands are defined in some standard way, \csname is used mostly for inner commands where you need some data storage or reference. – yo' Mar 17 '12 at 11:49
  • By greping for \DescribeMacro and suchlike in the .dtx files you'd get far less false positives (and more false negatives :-) But as this question is about documentation it's sensible to assume that the macro under consideration should at least be 'officially' documented. – Stephan Lehmke Apr 16 '12 at 13:27
  • @StephanLehmke ... considering the package was documented by .dtx and this was done correctly... – yo' Apr 16 '12 at 13:40
  • @StephanLehmke as well, .dtx files are not in every distro... – yo' Apr 16 '12 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.