[OS X TeX] Matrix in a subsections's title ?

Manfred Braun manfred.braun at uni-due.de
Thu Jul 14 07:41:27 EDT 2011


On 14.07.2011, at 12:14, Eric van der Oord wrote:

> I've put in my preamble :
> 
> \usepackage{amsmath,amssymb}
> \usepackage{array}
> \usepackage[medium,raggedright,md,compact]{titlesec}
> 
> %%%
> 
> In the document :
> 
> [some text]
> 
> \subsection{ bla bla $\begin{array}{cc} 1&2\\3&4 \end{array}$}
> 
> [some text]
> 
> causes the following error :
> 
> ./Ana-Plan deÃÅtailleÃÅ-2.tex:284: TeX capacity exceeded, sorry [input stack si
> ze=5000].
> \reserved at a ->\def \reserved at a 
>                               *{\ttl at assign@i {\@tempskipb }}\reserved at a 
> l.284 ...$\begin{array}{cc} 1&2\\3&4 \end{array}$}
> 
> ./Ana-Plan deÃÅtailleÃÅ-2.tex:284:  ==> Fatal error occurred, no output PDF fil
> e produced!
> 
> Is that a known issue ? How can I put a matrix in a subsections's title ?
> 

Eric,

try this:

\documentclass{article}
\newcommand\mymatrix{$\left[ \begin{array}{cc} 1 & 2 \\ 3 & 4 \end{array} \right]$}
\begin{document}
\section{Section Headline}
\subsection{Matrix \protect\mymatrix}
Some text \ldots
\end{document}

The reason of the failure is that the sectioning commands provide the headlines also for the table of contents and for running headlines, even if not used. Therefore commands within sectioning headlines must not be expanded immediately. The immediate expansion of a command is suppressed by \protect.  

Manfred

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://email.esm.psu.edu/pipermail/macosx-tex/attachments/20110714/a0340a64/attachment.html>


More information about the MacOSX-TeX mailing list