\label 和 \nameref 部分

\label 和 \nameref 部分
\documentclass[fleqn,12pt,a4paper]{article}
\usepackage{fontspec,xltxtra,xunicode}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{color}
\usepackage{setspace}
\usepackage{hyperref}
\usepackage{cmll}
\usepackage{tabularx}
\usepackage{pifont}
\usepackage{amstext, amsmath}
\usepackage{enumerate}

 %========================================================
\begin{document}
\section{This is Header1 6.1.77} \label{6.1.77}
\subsection*{This is sub header}
.
.
.
.
.a document of 100 pages
.
.a document of various tables and other sections 
.
.
.recalled lables at various places through out the document,
\nameref{} entire section header appeared nicely. 

\end{document}
  %========================================================

上面的代码运行得非常好,我可以\nameref{}在文档的任何地方使用它,并且它创建了一个超链接。我疯了,创建了多达 3900 个子部分,现在 PDF 只打印了两页,并且出现了堆栈溢出错误。超链接显示为??。我尝试使用enumerate,但它没有像在 的情况下那样超链接到特定的行\section{},还尝试过将行与标签放在一起,但仍然不起作用。

答案1

是的,我同意可能需要更多信息来解决该错误,但在浏览了您的代码后,只需附上一条注释:建议\usepackage{hyperref}按照您加载的包的顺序将其放在最后。偶尔,包需要放置在 hyperref 之后,但我认为这种情况并不多。否则,hyperref 可能会被覆盖,所以也许您可以看看这是否会改变您的超链接行为。

超链接手动的如果你愿意研究的话应该会有更多信息。

答案2

如果 Ulrich 的猜测是正确的,您可以特别允许 Latex 在各个部分开始新页面,因此:

\let\ursection=\section
\def\section{\pagebreak[0]\ursection}

(未经测试,因为没有 MWE)。

相关内容