Text Formatting\underset inside \section won't compile

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
farmerss
Posts: 2
Joined: Mon Jun 20, 2011 7:41 am

\underset inside \section won't compile

Post by farmerss »

Hi, I'm having trouble using an "\underset" command within a "\section" title. E.g. with the code

Code: Select all

%test.tex
\documentclass{article}
\usepackage{amsmath}
\begin{document}

\section{$\underset{}{}$}

\end{document}
I run "latex test" in the terminal, and get the output:

Code: Select all

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(./test.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texmf-texlive/tex/latex/amsmath/amstext.sty
(/usr/share/texmf-texlive/tex/latex/amsmath/amsgen.sty))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texmf-texlive/tex/latex/amsmath/amsopn.sty)) (./test.aux)
! Argument of \@tempb has an extra }.
<inserted text> 
                \par 
l.8 \section{$\underset{}{}$}
                             
? 
Runaway argument?
\mathrel \else \relax \fi \fi \@nil \endgroup \let \noexpand \binrel@@ \ETC.
! Paragraph ended before \@tempb was complete.
<to be read again> 
                   \par 
l.8 \section{$\underset{}{}$}
                             
? 
[1] (./test.aux) )
Output written on test.dvi (1 page, 260 bytes).
Transcript written on test.log.
If I compile inside kile, I get a similar response:

Code: Select all

LaTeX finished with exit code 1
./test.tex:8:Argument of \@tempb has an extra } \section{$\underset{}{}$}
./test.tex:8:Paragraph ended before \@tempb was complete \section{$\underset{}{}$}
Any ideas why it wouldn't work? Variations like e.g. "\section{a}{b}", or with some other text wrapping the "\section" command, still fail. But if I remove the "\section", or remove the "\underset", then things compile ok.

(I'm using the latex that came either with ubuntu 11.04 or maybe with kile 2.0.85. But the problem occurs with compliation in the terminal. The amsmath.sty that appears to be loading says "version 2.13" in it.)

Any help most appreciated.
Last edited by farmerss on Mon Jun 20, 2011 11:51 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

\underset inside \section won't compile

Post by Stefan Kottwitz »

Hi,

just use \protect:

Code: Select all

\section{$\protect\underset{}{}$}
Stefan
LaTeX.org admin
farmerss
Posts: 2
Joined: Mon Jun 20, 2011 7:41 am

Re: \underset inside \section won't compile

Post by farmerss »

Great, thanks! That works.
Post Reply