2

Please consider this document:

\documentclass{report}
\usepackage[portuguese]{babel}
\DeclareTextAccent{\'}{EU1}{"00B4}
\begin{document}
\chapter{Introduction}
\end{document}

If I try to compile it using XeLaTeX, then I get this error message:

! TeX capacity exceeded, sorry [input stack size=5000].
\'->\EU1-cmd \'
               \EU1\' 
l.5 \chapter{Introduction}

If you really absolutely need more capacity,
you can ask a wizard to enlarge me.

This occurs only if I use the Babel package with the portuguese option. I tried with other languages and all goes well.

What can I do to avoid this error?

  • 2
    The default encoding has been TU for at least a year. – egreg Nov 10 '17 at 11:35
  • 1
    @egreg Replacing EU1 with TU solves my problem. But why does this concern only the portuguese language? – José Carlos Santos Nov 10 '17 at 11:42
  • 1
    Because portuguese uses the accent for the chapter name, it would break with english too if you added a word with the accent. – Ulrike Fischer Nov 10 '17 at 12:57
  • @UlrikeFischer Thank you. That makes sense. – José Carlos Santos Nov 10 '17 at 12:57
  • Btw: The main problem with your definition is that you are trying to use an encoding (EU1) which due to the switch to TU is now unknown and so not properly setup. – Ulrike Fischer Nov 10 '17 at 13:01
2

The error shows with Portuguese and not English or French because LaTeX wants to typeset the localized version of “chapter” and “Capítulo” in Portuguese happens to contain \'i, which doesn't happen for other languages.

You get exactly the same with

\documentclass{report}
\usepackage[<language>]{babel}
\DeclareTextAccent{\'}{EU1}{"00B4}
\begin{document}
\'a
\end{document}

(any language option).

What happens is that EU1 is not a known encoding with the most recent versions of LaTeX, when using babel (also with fontspec): the default encoding is TU.

Your \DeclareTextAccent defines \' to expand to

\EU1-cmd \'\EU1\'

but \EU1-cmd is just \relax (because the encoding is not known) and this makes TeX spin its wheels trying to expand again \':

\'->\EU1-cmd \'
               \EU1\' 
\'->\EU1-cmd \'
               \EU1\' 

Solution:

\documentclass{report}
\usepackage[portuguese]{babel}
\DeclareTextAccent{\'}{\encodingdefault}{"00B4}
\begin{document}
\chapter{Introduction}
\end{document}

enter image description here

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.