是否可以在不使用完整缩写的情况下链接到缩写定义

是否可以在不使用完整缩写的情况下链接到缩写定义

我试着有点花哨缩写包。我定义了几个首字母缩略词(我在下面转储了一个例子),我想从我的文本中创建一个到首字母缩略词定义的链接,但是只链接到首字母缩略词的首字母,而不是整个字母。

所以我的首字母缩略词是“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}

相关内容