Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Often I'm trying to use a command in my document and it doesn't compile, because I haven't included the package I need for it. Of course, I know, that I can try to google it, but Google often finds some manuals and usage examples without package information (but this is probably because I don't know, how to google better). In all the cases I've succeeded in determining of the package name, but wasted more than 30 minutes in many of them.

Which ways would you advise to search for package name? Which hints would you suggest?

share|improve this question
There are some commands defined by more than one package... –  Seamus Oct 5 '10 at 11:42
@Seamus, of course, but it would still be nice to have a list of all the packages that provide a particular command. –  Juan A. Navarro Oct 5 '10 at 12:12
best source so far google: e.g. \scalebox ctan very rarely it fails. –  Yiannis Lazarides Dec 8 '10 at 15:17
Related question. –  Raphael Jun 11 at 14:49

5 Answers 5

up vote 9 down vote accepted
$ grep -r '\\commandname' $TEXMF/tex/latex
share|improve this answer
Heh, my scalebox comes from graphics. In any case, would it be better if you searched for '\\def\\commandname' instead? Searching for scalebox gives me a whole lotta other packages that use scalebox but not define it. –  Willie Wong Oct 5 '10 at 20:08
@Willie Wong: Then you'd miss e.g. \newcommand\commandname or \let\commandname. On the other hand, you'll always miss \expandafter\def\csname command\@empty name\endcsname. @All: you might try grep -IRF, then you don't have to double backslashes and binary files are ignored. –  Philipp Oct 5 '10 at 22:06
Instead of grep -r I suggest using ack, I find it much faster and the results easier to "understand". There is even a nice TextMate bundle for that... –  topskip Oct 6 '10 at 14:50
@Lev, how do I do this for MacTeX? Please add to the answer. –  Kit Oct 22 '10 at 14:26
Nice, although 1) it won't work on non-UNIX-based systems, 2) it requires you to have that package installed already. But still, nice ;-) –  Anthony Labarre Dec 8 '10 at 11:53

If the command is for a symbol, I would look it up in the comprehensive symbols list or in Detexify, both let you know which package you need to load in order to get the symbol.

If the command is for a specific topic or feature, I would try to google for “latex feature” or even “ctan feature” instead of searching for the particular command.

share|improve this answer

in general, ctan doesn't have this information (except in the sources of the packages themselves, of course). the catalogue package descriptions (already mentioned) do occasionally mention command names, but they're not a reliable source of this information.

there's no particular reason why ctan shouldn't hold the information, but collecting it would take absolutely ages. one would have to be careful about duplicates (mentions above of graphics vs graphicx for the same command, for example), and the simple volume of packages is going to make it an unwieldy operation.

(note that commands in latex itself aren't a problem, in that they appear at least twice on the web anyway.)

share|improve this answer

Succinctly: Go back to where you learned about the command for the first time (be it a person or a web page) and see if he/she/it can tell you.

More verbosely (since I got a downvote on this answer I'm guessing it's because I came off as glib, sorry): you put that command in the document for a reason. Either somebody suggested it or you found a code snippet on a web page somewhere. That same person/page should also know what package needs to be included to make it work.

Example 1 You are following the advice of your colleague, let's call him...Martin. But because the conversation took place in the hallway you couldn't write down the actual code required.

"Hey, Martin, you remember how you told me I could use \snarfbbf to snarf the bumblefrack?"


"Well, it doesn't work. It says the control sequence is undefined."

"Did you include the bbfrack package?"

"Oh, I get it. Thanks."

Example 2 Somebody (let's call him...Stefan) writes a blog post about snarfing bumblefracks in TeX documents. You copied-and-pasted a code snippet from part of the post. But because you didn't copy the preamble you have missed the required packages.

Go back to that web page, where either the complete document or a note about which packages are required should be there. If not, ask the blogger.

share|improve this answer

You can try searching here for the command name in the package descriptions on CTAN.

share|improve this answer
Searching for “scalebox”, e.g., gives no results. Remember that you are searching only in the packages’ descriptions, not in the packages’ files. Searching for “scalebox” in the documentation search box, on the other hand, gives 59 results, so you still don’t know where the command might come from. –  domwass Oct 6 '10 at 6:11
@domwass: I don't claim this will always or even usually be successful; it's just another thing to try. As you point out, documentation searches will usually give too many hits, but sometimes the description will say something like "provides the foo command". –  Mark Meckes Oct 6 '10 at 14:46

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.