1

I am trying to compile my work under MikTex 2.9 windows 7 and/or Kyle 2.1.2

The appendices are throwing an unsupported control sequence error when I try to compile with the langage set to Portuguese.

This is my preamble where the packages are loaded.

\usepackage[brazil,american]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{indentfirst}
\usepackage{natbib}
\usepackage{url}
\usepackage{xcolor,graphicx,url}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{epstopdf,placeins}
\usepackage{glossaries}
\usepackage{caption}
\usepackage[toc,page]{appendix}

If I set the language to English, document compiles ok.

The error message points to the .out file:

\BOOKMARK [0][-]{section*.40}{Refer\352ncias}{}% 35
\BOOKMARK [0][-]{Ap�ndice.1.A} <-------------- this line is throwing the error

Tried to compile it on Kyle (linux) and on Windows (MikTex), and both have the same error. Only difference is the character ê is printed on the .out file in Linux, and windows has that stupid question mark encoding error thing.

If I switch languages before calling the appendices chapters, everything runs fine.

Also, if I override the \def\appendixname{Ap\^endice}% from the PT babel file without the accent, it compiles just fine.

How can I compile the appendices in Portuguese (keeping the correct spelling of the word) without that error?

  • Does it compile if you substitute \^{e} for ê? – n.r. Mar 26 '14 at 20:15
  • The ê character is coming from the portuguese babel package. – Mindwin Remember Monica Mar 26 '14 at 20:23
  • 1
    What I think is happening is that the PT babel defines \def\appendixname{Ap\^endice}% and its being parsed into the .out file (where it is replced by the accented character), and afterwards it is being parsed again, generating that error. – Mindwin Remember Monica Mar 26 '14 at 20:46
  • If you've changed the babel language of the document, then clean auxiliary files before re-TeXing, or you can have rests from the new language environment that the new language environment doesn't understand. – pst Mar 26 '14 at 21:02
  • Yes, I clean auxiliary files before TeXing, and there is only one language environment anyway, and the character is coming from the right language environment... so? – Mindwin Remember Monica Mar 26 '14 at 21:12
  • Can you please show us a complete file that exhibits the problem, so we can try it out? You need to at least add a documentclass line and \begin{document} and \end{document} to the code you gave us.

    I don't know what you mean with "the right language environment". The preamble you have published sets american as the main language.

    – pst Mar 26 '14 at 22:03
  • You are loading \usepackage[utf8]{inputenc} and url twice. Try to redefine it using \^{e}. – Sigur Mar 26 '14 at 22:31

1 Answers1

3

I've had the same problem. The solution is to insert the following code in the preamble of your main source-file. The code should be after the lines where you loaded the packages hyperref and appendix.

\makeatletter
\renewcommand
   {\appendixtocname}{Ap\^{e}ndices}
 \renewcommand
   {\appendixpagename}{Ap\^{e}ndices}
 \renewcommand
   {\appendixname}{Ap\^{e}ndice} \let\oriAlph\Alph
 \let\orialph\alph
 \renewcommand{\@resets@pp}
   {\par\@ppsavesec  
     \stepcounter{@pps}%
     \setcounter{section}{0}%
     \if@chapter@pp
       \setcounter{chapter}{0}%
       \renewcommand\@chapapp{\appendixname}%
       \renewcommand\thechapter{\@Alph\c@chapter}%
     \else
       \setcounter{subsection}{0}%
       \renewcommand\thesection{\@Alph\c@section}%
     \fi
     \if@pphyper
       \if@chapter@pp
         \renewcommand
           {\theHchapter}
           {\theH@pps.\oriAlph{chapter}}%
       \else
         \renewcommand
           {\theHsection}
           {\theH@pps.\oriAlph{section}}%
       \fi
       \def\Hy@chapapp
          {appendix}%
     \fi
   \restoreapp
  }
\makeatother