0

I'm need to make a list of equation in my document. I found and use the modified version of Lev Bishop's code from here. Everything work until there's an accent in the equation label. I got this error message :

! TeX capacity exceeded, sorry [input stack size=5000].

\@latex@warning #1->\GenericWarning {\space \space \space \@spaces \@spaces ...

l.38 \label{eq:équation}

I'm currently using TeXnicCenter on Windows 7 but I tried others and they all gave me the same error... Do you have any solution ?

Example in Latex

\documentclass[pdftex,a4paper,11pt,twoside]{report}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}    
\usepackage{xstring}
\usepackage{tocloft}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\let\oldequation = \equation
\let\endoldequation = \endequation
\AtBeginDocument{\let\oldlabel = \label}
\newcommand{\mynewlabel}[1]{
    \fullexpandarg
    \StrBehind{#1}{eq:}[\Str]
    \myequations{\Str}\oldlabel{#1}}
\renewenvironment{equation}{
    \oldequation
    \let\label\mynewlabel
    }{\endoldequation}

\newcommand{\listequationsname}{Liste d'équations}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
    \addcontentsline{equ}{myequations{\hspace{15pt}\protect\numberline{\theequation}#1}}

 \setlength{\cftmyequationsnumwidth}{3em}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\listofmyequations

\begin{equation}
    2+2=4
    \label{eq:équation}
\end{equation}

\end{document}
1
  • 4
    Welcome to TeX.SX! It's best to avoid accented characters in labels.
    – egreg
    Aug 15, 2014 at 22:26

1 Answer 1

2

Labels should contain only ASCII characters, otherwise special characters, that are internally represented with control sequences, expand and you find terrible things in referring to such labels; if you change your label to equ:eqauation, getting rid of that é, everything will run smoothly. It is less French, but it works; after all labels should not be read by humans, but only by the typesetting engine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .