TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I write this line of code

\subsection{Ranger \( n \) boules distinguables dans \( M \) boîtes}

I obtain an error over the second \)

(./Probabilité.toc

./Probabilité.toc:8: LaTeX Error: Bad math environment delimiter.

while if I write

\subsection{Ranger $ n $ boules distinguables dans $ M $ boîtes}

everything is ok.

Why? \(\) has problems with TOC?

share|improve this question
up vote 18 down vote accepted

\( and \) are not robust, you need to \protect them. Or load package fixltx2e that makes them robust.

(Update:) Package fixltx2e defines the command \MakeRobust that redefines a macro in the same way, as the macro would has been defined by using \DeclareRobustCommand in the first place.

"Robust" means, that the macro can be used inside moving arguments (entries for the table of contents, header lines, …) without breaking and the need to add \protect in front of them.

share|improve this answer
    
Thank you. But what do you mean with "robust"? – R. M. Sep 25 '12 at 21:27
1  
    
@Werner Thank you! – R. M. Sep 25 '12 at 21:32
    
Package fixltx2e made it, thanks for your explanations. – Clément Nov 14 '14 at 14:03

A short 'aftermath': Since fixltx2e content has entered the LaTeX Kernel as of 2015/01/01 the fixltx2e amendments are available without loading the package.

This means: \(...\) is robust now without much further ado!

Heiko Oberdiek's answer is valid anyway for older distributions of course!

\documentclass{article}

\usepackage[utf8]{inputenc}
\begin{document}
\tableofcontents
\section{Ranger \( n \) boules distinguables dans \( M \) boîtes}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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