我正在使用发布的宏这里(参见第一个答案),自动将章节编号添加到 \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}