如何將單字與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}

相關內容