![cleveref で単語をリンクするにはどうすればいいですか?](https://rvso.com/image/391720/cleveref%20%E3%81%A7%E5%8D%98%E8%AA%9E%E3%82%92%E3%83%AA%E3%83%B3%E3%82%AF%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%81%84%E3%81%84%E3%81%A7%E3%81%99%E3%81%8B%3F.png)
ファイルの末尾にある意味に単語をリンクすることは可能ですか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
andを使用できないことです。これは、セットアップによっては、LaTeX が最近増加したカウンター変数と\cref
意味のある関連付けを行うことができないためです。\label
しかし、良いニュースもあります。パッケージの\hyperlink
およびマクロを使用することで、タイプセッティングの目的を完全に達成できます。 とはどちらも2 つの引数を取るマクロです。最初の引数は同じである必要があります (以下の例を参照)。2 番目は自由形式で、以下の例でそれぞれ と です。\hypertarget
hyperref
\hyperlink
\hypertarget
cheetah_def
cheetah
\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}