Possible Duplicate:
Where do I find out how a command/environment is defined?

Is there a more or less general and (hopefully) convenient way to learn what is a command encountered in a source file?

Let's take a few lines right at the beginning of book.cls:

          [2007/10/19 v1.4h
          Standard LaTeX document class]
\newif\if@mainmatter \@mainmattertrue

The subject question applies literally to every line:

  • What is \ProvidesClass and how to look it up?

  • What is \newif and how to look it up?

  • What is \DeclareOption and how to look it up?

I'd like to know where exactly the better known \newcommand is declared, for that matter.

marked as duplicate by lockstep, N.N., Marco Daniel, Roelof Spijker, Joseph Wright Jan 6 '12 at 21:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from stackoverflow.com Jan 6 '12 at 13:10

This question came from our site for professional and enthusiast programmers.

  • Google is your friend. – Seamus Jan 6 '12 at 13:13
  • Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. – N.N. Jan 6 '12 at 13:47
  • 2
    Since thes are serval questions which can all be answerd by reading a good book about LaTeX (e.g. the LaTeX Companion) or google them and then coming back with a more detailed question if there is a thing your book/google left out or didn’T answer … – Tobi Jan 6 '12 at 13:57

You can use texdef too look up the definitions as described in https://tex.stackexchange.com/a/31123/5701.

  • I don't think texdef is going to help someone understand what \ProvidesClass is doing… – Seamus Jan 6 '12 at 13:13
  • Now that this question has been migrated to tex.sx, perhaps you should either elaborate on your answer or (in case the question is a real duplicate) convert your answer to Community Wiki or a comment. – lockstep Jan 6 '12 at 13:16
  • @lockstep I have converted it to community wiki make it easier for others to fill in. – N.N. Jan 6 '12 at 13:49

One quick way is to use show. From the command line start pdflatex interactively:

% pdflatex
* \documentclass{book}
* \show\ProvidesClass
> \ProvidesClass=macro:
#1->\xdef \@gtempa {#1}\ifx \@gtempa \@currname \else \@latex@warning@no@line {
You have requested \@cls@pkg \space `\@currname ',\MessageBreak but the \@cls@p
kg \space provides `#1'}\fi \@ifnextchar [\@pr@videpackage {\@pr@videpackage []
<*> \show\ProvidesClass

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