我一直在用葡萄牙语写一份文件,遇到了一个棘手的问题。过去几个小时,我一直在尝试让 hyperref 和 bookmark 与附录环境中的标签配合良好,但无济于事。我不断收到奇怪的、不完整的错误消息(未定义的控制序列),我似乎无法解决。我觉得这与更改的附录页面名称有关,但我不太确定。
下面,您将看到一个不起作用的示例,它输出的错误消息与我在主 .tex 文件中收到的错误消息完全相同。如果您能给我任何帮助,我将不胜感激!我似乎无法独自解决这个问题。
\documentclass{article}
\usepackage[portuguese]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[unicode]{hyperref}
\usepackage{bookmark}
\usepackage{fancyvrb}
\usepackage{parskip}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{float}
\usepackage[toc,page]{appendix}
\usepackage[margin=1.3in]{geometry}
\addto{\captionsportuguese}{\renewcommand{\appendixpagename}{Apêndice}}
\epstopdfsetup{outdir=./}
\begin{document}
\section{Test}
\subsection{SubTest}
Ref'ing an appendix \ref{figure_flowchart1}; \ref{figure_flowchart2}.
\begin{appendices}
\section{Diagrama 1 - Atualização de Paridade, 1 Bloco de Dados}\label{figure_flowchart1}
\begin{figure}[H]
\centering
\includegraphics[scale=0.5]{Flowchart1.eps}
\end{figure}
\section{Diagrama 2 - Atualização de Paridade, >1 Bloco de Dados}\label{figure_flowchart2}
\begin{figure}[H]
\centering
\includegraphics[scale=0.5]{Flowchart2.eps}
\end{figure}
\end{appendices}
\end{document}
答案1
这是包中的一个错误appendix
:包在计数器名称的位置hyperref
使用内部目标名称。然后部分(类)或章节(类或)使用字符串“附录”而不是“节”/“章”作为附录中目标的计数器名称部分。包重新定义为附录。被本地化为“Apêndice”,第三个 UTF-8 字母导致了问题。使用原始 ASCII 字符串“附录”更加可靠。名称不会出现在页面上的任何地方。(计数器名称“章”或“节”也未本地化。)\Hy@chapapp
article
report
book
appendix
\Hy@chapapp
\appendixname
\appendixname
以下示例将补丁程序添加\Hy@chapapp
到附录中以作为“附录”:
\documentclass{article}
\usepackage[portuguese]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[unicode]{hyperref}
\usepackage{bookmark}
\usepackage[toc,page]{appendix}
\usepackage{etoolbox}
\makeatletter
\patchcmd\@resets@pp{%
\def\Hy@chapapp{\appendixname}%
}{%
\def\Hy@chapapp{appendix}%
}{}{\errmessage{Cannot patch \string\@resets@pp}}
\patchcmd\@resets@ppsub{%
\def\Hy@chapapp{\appendixname}%
}{%
\def\Hy@chapapp{appendix}%
}{}{\errmessage{Cannot patch \string\@resets@pp}}
\makeatother
\addto{\captionsportuguese}{\renewcommand{\appendixpagename}{Apêndice}}
\begin{document}
\section{Test}
\subsection{SubTest}
Ref'ing an appendix \ref{figure_flowchart1}; \ref{figure_flowchart2}.
\begin{appendices}
\section{Diagrama 1 - Atualização de Paridade, 1 Bloco de Dados}
\label{figure_flowchart1}
\section{Diagrama 2 - Atualização de Paridade, >1 Bloco de Dados}
\label{figure_flowchart2}
\end{appendices}
\end{document}