![附录部分引用错误](https://linux22.com/image/461090/%E9%99%84%E5%BD%95%E9%83%A8%E5%88%86%E5%BC%95%E7%94%A8%E9%94%99%E8%AF%AF.png)
我正在使用发布的宏这里(参见第一个答案),自动将章节编号添加到 \nameref。
处理附录时,它不添加附录章节的参考编号,而是添加当前章节的参考编号。
有什么更正吗?
\documentclass{article}
\makeatletter
\newcommand\appendix@section[1]{%
\refstepcounter{section}%
\orig@section*{Appendix \@Alph\c@section~: #1}%
\addcontentsline{toc}{section}{Appendix \@Alph\c@section~: #1}%
}
\let\orig@section\section
\g@addto@macro\appendix{\let\section\appendix@section}
\makeatother
\usepackage{hyperref}
\begin{document}
\section{My first section}
\section{My second section}
The reference \ref{ApendixA} is displayed correctly. \\
The reference B in : \nameref{ApendixA} is not correct. It refers to the alphabetical numbering of section 2, instead of the reference A in the appendix.
\appendix
\section{Biblio} \label{ApendixA}
\end{document}