9

I am a beginner in LaTeX. There are some commands that I don't understand (for example \mathop and \operatorname). I want to find some material about them, but I don't know where to look.

What is a good general reference for looking up LaTeX commands? To which book or website should I refer?

TRiG
  • 213
  • 1
  • 12

2 Answers2

7

There is no simple answer to this question, since the number of possible macros is arbitrarily large.

Furthermore, there are both LaTeX macros and TeX macros, which in packages are often intermixed.

The best free resource for TeX itself is Victor Eijkhout's TeX by Topic which should be part of your distribution's documentation (use texdoc texbytopic to display it).

For the core LaTeX macros (i.e., those defined in the LaTeX kernel) you can look at the source documentation for LaTeX. (this should also be on your system: texdoc source2e should display it).

For any other macros you should look at the package documentation that defines them. This is especially true for user level macros; for internal macros you may need to look at the source of the package or class itself.

Alan Munn
  • 218,180
6

Knowing which commands do which operation depends on the way one searches.

  • With more experience you know commands by heart (believe me, you will do!)
  • Having an introductory textbook on LaTeX definitely helps

  • Some commands are hard to remember, it requires some clue which package defines them

    If the package or class is known, it's best to browse the information TeXDoc provides

  • Looking into package or class files might help

  • On linux/unix the console command texdef -t latex -p amsmath \operatorname will show the definition of \operatorname, for example, it will output

\operatorname:
macro:->\protect \operatorname

\operatorname : \long macro:->@ifstar {\qopname \newmcodes@ m}{\qopname \newmcodes@ o}

How much this helps depends a little bit on experience, however ;-)

For special topics:

Unfortunately non - free material: The TeXBook by Donald E. Knuth

  • ftp.cs.stanford.edu/tex/dist/tex/texbook.tex – Johannes_B Nov 04 '15 at 12:16
  • @Johannes_B: Yes, I know that, but you can't compile it :-P –  Nov 04 '15 at 12:21
  • 1
    Looking at the code is enough for me ;-) – Johannes_B Nov 04 '15 at 12:22
  • Personally I prefer \meaning or \csmeaning (this last one from etoolbox package) using \meaning\macro or \meaning{macro}; which prints the definition into the document. For me, that don't usually open the terminal, it's cleaner to just compile a document and see the definition. – Manuel Nov 04 '15 at 17:49