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

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.

share|improve this question

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

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

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.

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
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 http://tex.stackexchange.com/a/31123/5701.

share|improve this answer
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
share|improve this answer
Again, \show is just thoroughly unhelpful for a command like \ProvidesClass. – Seamus Jan 6 '12 at 15:34
Well you are correct. It is good for some commands, but \ProvidesClass is not one of them. In general I think the best way to find LaTeX2e definitions is in the commented source itself. Here is an online version tug.org/texlive/Contents/live/texmf-dist/doc/latex/base/… and here is a hardcover version. lulu.com/product/hardcover/latex-sources/971405 Although it has an author listed, that is just the person who uploaded the pdf. – Tim A Jan 6 '12 at 19:21