在附錄中使用葡萄牙語會引發不受支持的控制序列

在附錄中使用葡萄牙語會引發不受支持的控制序列

我正在嘗試在 MikTex 2.9 windows 7 和/或 Kyle 2.1.2 下編譯我的作品

當我嘗試使用設定為葡萄牙語的語言進行編譯時,附錄拋出不受支援的控制序列錯誤。

這是我載入包的序言。

\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}

如果我將語言設定為英語,則文件可以正常編譯。

錯誤訊息指向 .out 檔案:

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

試著在 Kyle (linux) 和 Windows (MikTex) 上編譯它,兩者都有相同的錯誤。唯一的區別是 Linux 中的字元ê列印在 .out 檔案上,而 Windows 則有愚蠢的問號編碼錯誤。

如果我在呼叫附錄章節之前切換語言,一切都會正常運作。

另外,如果我覆蓋\def\appendixname{Ap\^endice}%PT babel 檔案中的 而不帶重音符號,它編譯得很好。

如何用葡萄牙語編譯附錄(保持單字的正確拼字)而不出現該錯誤?

答案1

我也遇到同樣的問題。解決方案是在主源文件的序言中插入以下程式碼。該程式碼應該位於載入包hyperrefappendix.

\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

相關內容