如何在LaTeX中发出引用的文本内容?

Jam*_*sen 4 latex

我有一节:

\section{Introduction} \label{sec:introduction}
Run Code Online (Sandbox Code Playgroud)

我想要一个链接到链接文本是该部分名称的部分.我可以用hyperref:

The \hyperrf[sec:introduction]{Introduction} introduces the paper.
Run Code Online (Sandbox Code Playgroud)

但这需要重复章节标题("简介").有没有办法抓住它?ref产生节号,这是不对的. autoref产生"部分",然后产生部分编号,这也是不正确的.

Wil*_*son 10

有几个包为您提供此功能.nameref作为hyperref的一部分进行分发,以执行此操作:http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id = nameref

有一个更通用的包,用于交叉引用基本上任何东西,称为zref:http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id = zref

它与hyperref,Heiko Oberdiek在同一位作者; 这是我会选择的那个.这是一个例子:

\documentclass[oneside,12pt]{article}
\usepackage[user,titleref]{zref}
\begin{document}
\section{Introduction of sorts.}\zlabel{sec:intro}
Hello
\subsection{Structure}
We begin in `\ztitleref{sec:intro}'.
\end{document}
Run Code Online (Sandbox Code Playgroud)

请注意,它甚至删除了节标题中的尾随句点.