0

Following up this excellent question, I've tried to find the definition of the \chapter command via

 texdef -t latex -f chapter -s

It shows then the following output:

\chapter:
undefined

While for other commands, it works fine, e.g. for \section etc.

texdef -t latex -f section -s

giving the output

% article.cls, line 302:
\newcommand\section{\@startsection {section}{1}{\z@}%
                               {-3.5ex \@plus -1ex \@minus -.2ex}%
                               {2.3ex \@plus.2ex}%
                               {\normalfont\Large\bfseries}}

It also works fine for \part etc.

What is wrong?

jjdb
  • 2,238
  • 1
    you need -c book to get the definition of \chapter for the book class, it seems to default to the latex format + article class (where \chapter is not defined) so nothing is wrong, it is correctly telling you that \section and \part are defined but \chapter is not (using the default article class) – David Carlisle May 03 '17 at 11:03
  • Thanks a lot! Yeah, I should have read the help page. I tried man texdef but forgot about texdef --help. You want to put an answer, or you think this question should rather be closed? – jjdb May 03 '17 at 11:10

1 Answers1

1

you need -c book to get the definition of \chapter for the book class, it seems to default to the latex format + article class (where \chapter is not defined).

So nothing is wrong, it is correctly telling you that \section and \part are defined but \chapter is not (using the default article class)

David Carlisle
  • 757,742
  • Thank you again. May I edit the question to include an follow up? I was wondering if I can use texdef to find how a specific document uses the \chapter definition. So can I give a file mydocument.tex as argument to texdef? – jjdb May 03 '17 at 11:16
  • @jjdb ive never used texdef, but I think not but you could of course use -c and specify whatever class the document uses. – David Carlisle May 03 '17 at 11:21
  • So one should probably then try first the class, then all packages one uses… could be some work, though… probbably better to use this approach https://tex.stackexchange.com/a/4348/28751 – jjdb May 03 '17 at 11:36