When I use the amsbook document class, and write down sections of chapters using $\section{Section}$, latex returns an error calling \section an 'undefined' controlled sequence. What can I do to get sections in amsbook?

  • 2
    Welcome to TeX.SX! When I use amsbook I get \section{foo} working, but don't use $\section{foo}$ -- Why do you want to use a sectioning command in math-mode? Do you mean \section{Foo $some math content$} ? – user31729 Jan 16 '16 at 10:24

Both amsbook.cls as article.cls use the \par code in \@startsection, this isn't allowed in mathmode, that's why $\section{foo}$ must fail.

  • wait for the OP to come back but I'd guess the $ was a mistake in the site wiki markup using $ instead of ` rather than something in the document. – David Carlisle Jan 16 '16 at 11:16
  • @DavidCarlisle: That's true, but nevertheless my answer isn't wrong, is it? – user31729 Jan 16 '16 at 11:34
  • @Zarko: Really? ;-) – user31729 Jan 16 '16 at 11:41
  • yes it's wrong really since the question says there is an undefined control sequence error. I would guess that the actual problem is \section{\zhagagafa} and \section is just reported as the location, but teh undefined command is \zhagagafa – David Carlisle Jan 16 '16 at 11:54
  • @DavidCarlisle: True -- I've answered another wrong feature of the question ;-) – user31729 Jan 16 '16 at 12:01

amsbook defines \section so that is not the problem.

I would guess that your document looks like this:



\section{zzzz a\xyz\ hhh}



which produces a message on the terminal like

! Undefined control sequence.
<argument> zzzz a\xyz 
                      \ hhh
l.5 \section{zzzz a\xyz\ hhh}


this does not say that \section is undefined, the last line of a TeX error message shows the location in the source so here l.5 line 5 \section{zzzz a\xyz\ hhh}

The important part of the error message is the first line which is always split over two lines with the linebreak showing the point at which TeX stopped reading and issued the error.

So for an undefined control sequence error the control sequence that is undefined is always the last token on the first line of the message after the !... line. Here \xyz.

The solution is to define that command, but it depends what the command is, for which we need to see the full error message as above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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