2

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:

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{book}
          [2007/10/19 v1.4h
          Standard LaTeX document class]
\newcommand\@ptsize{}
\newif\if@restonecol
\newif\if@titlepage
\@titlepagetrue
\newif\if@openright
\newif\if@mainmatter \@mainmattertrue
\if@compatibility\else
\DeclareOption{a4paper}

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.

  • Google is your friend. – Seamus Jan 06 '12 at 13:13
  • Welcome to TeX.sx! Your question was migrated here from [so]. 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 06 '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 06 '12 at 13:57

2 Answers2

2

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

N.N.
  • 36,163
  • I don't think texdef is going to help someone understand what \ProvidesClass is doing… – Seamus Jan 06 '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 06 '12 at 13:16
  • @lockstep I have converted it to community wiki make it easier for others to fill in. – N.N. Jan 06 '12 at 13:49
1

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
Tim A
  • 1,945
  • Again, \show is just thoroughly unhelpful for a command like \ProvidesClass. – Seamus Jan 06 '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 http://www.tug.org/texlive/Contents/live/texmf-dist/doc/latex/base/source2e.pdf and here is a hardcover version. http://www.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 06 '12 at 19:21