TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does there exist a tool to find in what package a given macro is defined? I have to work with LaTeX (not XeLaTeX, for legacy reasons). I'm dealing with very old code, which I have to get compiled. So, if I encounter an unknown command, I have to include the corresponding package. Currently, I just google and hope to find the right package. Does there exist something like Hoogle (which is a search engine for Haskell), but for LaTeX?

share|improve this question
Maybe my answer here can help you? – Stephan Lehmke May 25 '12 at 17:32
There is no existing package that can figure out which macro belongs to which package, since some packages redefine macros, effectively duplicating the source. The other way around though (finding out the macro definition given a package/class) is possible via texdef. – Werner May 25 '12 at 17:33
I found a package (it's not on CTAN) that defined \value, \left and \right. Really! It's quite hopeless to do a search in the 1588 (current value) directories under <TeXLive root>/tex/latex (and there are other places where to look for packages). – egreg May 30 '12 at 17:47
@egreg I routinely grep through <TeXLive root>/tex/latex, and I think Joseph Wright also does. This is useful for us to know how much a given LaTeX3 feature is used. – Bruno Le Floch Aug 28 '12 at 19:10

I don't know the answer but seeing how long this went unanswered ... in case you don't use Windows, you could use this kludge of a command line:

find kpsewhich -show-path=tex | sed 's/:/ /g' | sed 's/\!\!//g' -name '.sty' -or -name '.cls' -or -name '*.tex' | xargs grep MACRO

It probably finds much too much but if "MACRO" is not too common a word, it might help :/

This assumes of course, that you just installed every package there is with something like a full TeXLive install or something.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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