
我試著有點花哨縮寫詞包裹。我定義了幾個首字母縮略詞(我在下面轉儲了一個示例),我想從我的文本中鏈接到首字母縮略詞定義,但針對首字母縮略詞的第一個字母而不是整個內容。
所以我的縮寫是“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}