我正在尝试添加一个链接到同一符号的符号,无论下标如何。因此 \tau_{x} 和 \tau_{2300} 都应该链接到符号列表中的 \tau。
我找到了 \glsarg 选项,但不知何故指定它不会导致文本中出现下标,而将其更改为词汇表中的常规下标会导致它在文本中显示为下标。我该如何解决这个问题?
梅威瑟:
\documentclass[12pt]{book}
\usepackage{natbib}
\usepackage{float}
\usepackage{tabularx}
\usepackage{paralist}
\usepackage{adjustbox}
\usepackage{amsmath}
\usepackage[acronyms,nonumberlist,nopostdot]{glossaries}
\BeforeBeginEnvironment{tabularx}{\begin{center}\small}
\AfterEndEnvironment{tabularx}{\end{center}}
\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}
\newglossarystyle{symbunitlong}{%
\setglossarystyle{long3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
\begin{longtable}{lp{1.35\glsdescwidth}>{\centering\arraybackslash}p{2cm}}}%
{\end{longtable}}%
%
\renewcommand*{\glossaryheader}{% Change the table header
\bfseries Symbol & \bfseries Description & \bfseries Unit \\
\hline
\endhead}
\renewcommand*{\glossentry}[2]{% Change the displayed items
\glstarget{##1}{\glossentryname{##1}} %
& \glossentrydesc{##1}% Description
& \glsunit{##1} \tabularnewline}}
\makeglossaries
% Allow for subscripts
\glsnoexpandfields
\newcommand*{\glsarg}{}
% syntax: \newgreeksymbol[options]{label}{name}{description}{unit}
\newcommand{\newgreeksymbol}[6][]{%
\newglossaryentry{#2}{name={#3},text={#6},sort={>#2},description={#4},unit={#5},#1}%
}
\newgreeksymbol{tau}{\ensuremath{\tau}}{Shear modulus}{\ensuremath{Pa}}{\ensuremath{\tau_{\glsarg}}}
\begin{document}
\setglossarysection{section}
\setglossarystyle{super}
\renewcommand*{\glsgroupskip}{}
\printglossary[style=symbunitlong,title=List of Symbols]
\printglossary[type=\acronymtype,title={List of Abbreviations}]
\glsaddall
Testing \gls{tau}[op]. "op" should show up as a subscript.
\end{document}