將帶有下標的符號作為參數加入詞彙表

將帶有下標的符號作為參數加入詞彙表

我正在嘗試添加一個連結到同一符號的符號,無論下標如何。因此 \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}

相關內容