如何用 cleveref 链接单词?

如何用 cleveref 链接单词?

是否可以将单词与文件末尾的含义联系起来cleveref

这是我的代码的 MWE:

\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}
    Today I ran like a \label{cheetah}cheetah and it was amazing to feel the wind.

    \pagebreak

    \cref{cheetah}: is a large cat of the subfamily Felinae that occurs in North, Southern and East Africa, and a few localities in Iran. It inhabits a variety of mostly arid habitats like dry forests, scrub forests, and savannahs.
\end{document}

我希望句子中的名字 cheetah 可以链接到文档末尾的含义,并且当我调用\cref{cheetah}它时只显示名字 cheetah 而不是数字。

答案1

有好消息也有坏消息。坏消息是你不能使用\label\cref来实现交叉引用的目标。这是因为,鉴于你的设置,LaTeX 无法\label与最近增加的计数器变量有意义地关联。

但也有好消息!您可以使用包中的\hyperlink和宏完全实现排版目标。和都是接受两个参数的宏。第一个必须相同——在下面的例子中。第二个是自由格式——和,在下面的例子中分别是。\hypertargethyperref\hyperlink\hypertargetcheetah_defcheetah\textbf{Cheetah}

\documentclass{article}
\usepackage{hyperref}
\begin{document}

Today I ran like a \hyperlink{cheetah_def}{cheetah} and 
it was amazing to feel the wind.

\pagebreak

\noindent
\hypertarget{cheetah_def}{\textbf{Cheetah}}: A large cat 
of the subfamily Felinae that occurs in North, Southern 
and East Africa, and a few localities in Iran. It inhabits 
a variety of mostly arid habitats such as dry forests, 
scrub forests, and savannahs.
\end{document}

相关内容