4

So far, whenever I needed to know where exactly a command (or my fuzzy concept about some specific task) has been defined, I have used a search engine to find it out.

But if I know about the particular (specific) package, we can use texdoc. For example, if we need to read more about the graphicx package, we use,

texdoc graphicx

and that particular documentation pops up.

Now, let us say that I know about the command \AtBeginEnvironment, but not sure which style file to be used for this. Is there any other way than using a web search engine to find out that indeed etoolbox needs to be used?

If I use,

texdoc AtBeginEnvironment

I get,

Sorry, no documentation found for AtBeginEnvironment.
If you are unsure about the name, try searching CTAN's TeX catalogue at
http://ctan.org/search.html#byDescription.

Taking this one step further, let us say that I have a fuzzy concept of things to be done (put some command at environment start e.g.), but do not exactly know how to achieve this, is there a way to point me to the correct packages? Again, not using search engine?

I understand that we all have got used to having Internet at hand take and it for granted. But things get a little difficult when Internet access is limited or completely unavailable.

  • You mean besides grep? – jon Oct 21 '15 at 1:24
  • Google with <query> site:tex.stackexchange.com is pretty quick. – erik Oct 21 '15 at 1:44
  • @erik You missed the basic requirement, without using a search engine. – Masroor Oct 21 '15 at 2:17
  • 1
    I think, really, you mean "without an internet connection"? It is, after all, possible to open the CTAN page and search without an 'Internet search engine' in the usual sense. The point, surely, is that you want an offline option. – cfr Oct 21 '15 at 2:51
  • 1
    Remember that macro definitions are sometimes embedded in other definitions or in constructs beginning with \csname, so a complete search would essentially need to parse TeX. But if your hopes are more modest, check out tlwhich. However, it's capabilities could be expanded fairly easily. – jon Oct 21 '15 at 3:14
3

You can use tlmgr to search for information about installed packages using filename, long and short description, for example. This is not a search for commands. It is more like CTAN's search but less powerful. You can use regular expressions etc.

You will not always get a complete set of results. For example, searching for patch does not return etoolbox:

$ tlmgr search patch
HA-prosper - Patches and improvements for prosper.
issuulinks - Produce external links instead of internal ones.
jknapltx - Miscellaneous packages by Joerg Knappen.
ltabptch - Bug fix for longtable.
lualatex-math - Fixes for mathematics-related LuaLaTeX issues
marginfix - Patch \marginpar to avoid overfull margins.
memoir - Typeset fiction, non-fiction and mathematical books.
oberdiek - A bundle of packages submitted by Heiko Oberdiek.
ogham - Fonts for typesetting Ogham script.
patch - Patch loaded packages, etc..
patchcmd - Change the definition of an existing command.
pittetd - Electronic Theses and Dissertations at Pitt.
realscripts - Access OpenType subscript and superscript glyphs.
regexpatch - High level patching of commands.
shapepar - A macro to typeset paragraphs in specific shapes.
sphack - Patch LaTeX kernel spacing macros.
tamefloats - Experimentally use \holdinginserts with LaTeX floats.
xltxtra - "Extras" for LaTeX users of XeTeX.
xpatch - Extending etoolbox patching commands.

Although the final result does at least mention etoolbox.

Similarly, you can use texdoc to search for a word, but only in the path names of files. So this option is more limited than the search provided by tlmgr which also searches the package descriptions.

$ texdoc -l patch
 1 /usr/local/texlive/2015/texmf-dist/doc/latex/patchcmd/patchcmd.pdf
   = Package documentation
 2 /usr/local/texlive/2015/texmf-dist/doc/latex/regexpatch/regexpatch.pdf
   = Package documentation
 3 /usr/local/texlive/2015/texmf-dist/doc/latex/xpatch/xpatch.pdf
   = Package documentation
 4 /usr/local/texlive/2015/texmf-dist/doc/latex/regexpatch/README
   = Readme
 5 /usr/local/texlive/2015/texmf-dist/doc/latex/xpatch/README
   = Readme
 6 /usr/local/texlive/2015/texmf-dist/doc/latex/oberdiek/hopatch.pdf
 7 /usr/local/texlive/2015/texmf-dist/doc/latex/base/patches.txt
 8 /usr/local/texlive/2015/texmf-dist/doc/latex/flabels/makedoc-patched
Please enter the number of the file to view, anything else to skip: 

If you are really desperate, you can search for all package files, say, and then search those files for a pattern. On a Unix-ish system, for example, find $(kpsewhich -var TEXMFMAIN)/tex/latex -path '*.sty' and then run something like grep '\\AtBeginEnvironment' on the results. But you would need to be reasonably desperate (but not in a hurry!) to do this. On the other hand, if you have an idea of the package it might be in, just grepping half a dozen package files is extremely fast.

  • ok, deleting my comment. good answer by the way, nice to see tlmgr search mentioned as it got an enhancement and searches in more places with TL2015. – user4686 Oct 21 '15 at 15:23
  • ah sorry, actually I meant tlmgr info which since TL2015 provides more extant results. Which however is less appropriate in this context than tlmgr search (tlmgr info patch finds the package with that name and nothing else). I will end up deleting this and the previous comment too... (after a while) – user4686 Oct 21 '15 at 15:26
  • Thanks. I think tlmgr is under-appreciated. – cfr Oct 21 '15 at 20:49
  • on Mac OS X, TLU provides a very nice graphical interface; for some years I used only that. But a few months back I needed to install TeXLive on a Linux box all by myself, and at last started using tlmgr during the pretest period of TL2015, also on my Mac. Since, I returned to TLU for 99% of the time on the Mac, but being now familiar with tlmgr from Linux side, I have grown to appreciate its possibilities. (of which I use only a tiny fraction) – user4686 Oct 21 '15 at 20:56
  • I've never used (or even seen) the/a GUI version, though obviously I know they exist. – cfr Oct 21 '15 at 20:57

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.