完全な頭字語を使用せずに頭字語の定義にリンクすることは可能ですか?

完全な頭字語を使用せずに頭字語の定義にリンクすることは可能ですか?

私はちょっと派手にしようとしています頭字語パッケージ。いくつかの頭字語を定義しています (以下に例を示します)。テキストから頭字語の定義へのリンクを作成したいのですが、頭字語全体ではなく、頭字語の最初の文字に対してリンクを作成したいと思います。

私の頭字語は「S-wave」なので、「S」を何らかの方法で書いて頭字語にリンクさせたいと思います。

\documentclass{article}
\usepackage{hyperref}
\usepackage{acronym}
\usepackage{lipsum}
\begin{document}
\acused{swave}\acused{pwave}\acused{dwave} % mark as used for this example

I'd like to have the `S' linked to the entry for the acronym `S-wave' in the following sentence.

The system comprises of both S- and \ac{pwave} components. By contrast, the \ac{dwave} contribution is negligible.

\lipsum[3]

\section*{List of acronyms}
\begin{acronym}
  \acro{swave}[S-wave]{the $K\pi$ system in a scalar, $J=0$ state}
  \acro{pwave}[P-wave]{the $K\pi$ system in a vector, $J=1$ state}
  \acro{dwave}[D-wave}{the $K\pi$ system in a tensor, $J=2$ state}
\end{acronym}
\end{document}

答え1

hyperrefのを使用することができます\hyperlink{link target}{link text}:

\hyperlink{swave}{S}

acronym内部マクロ を使用すると、小さな利点が得られます。がロードされていない\AC@hyperlink{link target}{link text}場合に がエラーになるという小さな利点があります。hyperref

必要なのは適切なラッパーだけです

\makeatletter
\newcommand*\aclink{\AC@hyperlink}
\makeatother

完全なコード:

\documentclass{article}
\usepackage{hyperref}
\usepackage{acronym}
\usepackage{lipsum}

\makeatletter
\newcommand*\aclink{\AC@hyperlink}
\makeatother

\begin{document}
\acused{swave}\acused{pwave}\acused{dwave} % mark as used for this example

I'd like to have the `S' linked to the entry for the acronym `S-wave' in the
following sentence.

The system comprises of both \aclink{swave}{S}- and \ac{pwave}
components. By contrast, the \ac{dwave} contribution is negligible.

% or:

The system comprises of both \hyperlink{swave}{S}- and \ac{pwave}
components. By contrast, the \ac{dwave} contribution is negligible.

\lipsum[3]

\section*{List of acronyms}
\begin{acronym}
  \acro{swave}[S-wave]{the $K\pi$ system in a scalar, $J=0$ state}
  \acro{pwave}[P-wave]{the $K\pi$ system in a vector, $J=1$ state}
  \acro{dwave}[D-wave]{the $K\pi$ system in a tensor, $J=2$ state}
\end{acronym}

\newpage\null % add an empty page so we can see the links go to the right place

\end{document}

関連情報