
Я пытаюсь быть немного более нарядным сакронимpackage. У меня есть несколько определений аббревиатур (пример я привожу ниже), и я хотел бы сделать ссылку на определение аббревиатуры из моего текста, но для первой буквы аббревиатуры, а не для всего текста.
Итак, мой акроним — «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}