我有多个类似的词汇表,但索引不同。我想让所有词汇表都链接到一个词汇表条目。可以吗?
代码:
\documentclass{article}
\usepackage[unicode, colorlinks=true]{hyperref}
\usepackage[automake, acronym, nopostdot, nonumberlist, style=super, shortcuts]{glossaries}
\setlength{\glsdescwidth}{0.9\textwidth}
\makeglossaries
\newglossaryentry{F1}{name = \ensuremath{F_1}, description = Force in cross-section 1}
\newglossaryentry{F2}{name = \ensuremath{F_2}, description = Force in cross-section 2}
\newglossaryentry{F3}{name = \ensuremath{F_3}, description = Force in cross-section 3}
\glsaddall
\begin{document}
\printglossary
\section{Text}
There are three cross-sections.
The force in cross-section 1: $\gls{F1} = 10 kN$.
The force in cross-section 2: $\gls{F2} = 15 kN$.
The force in cross-section 3: $\gls{F3} = 20 kN$.
\end{document}
目前它看起来像这样:
我希望它看起来像这样:
我希望词汇表 F_1、F_2 和 F_3 指向词汇表中的 F_i。
答案1
正如 Nicola Talbot 在他的评论中提到的那样,可以找到答案这里。
使用建议的方法,我的新代码将如下所示
\documentclass{article}
\usepackage[unicode, colorlinks=true]{hyperref}
\usepackage[automake, acronym, nopostdot, nonumberlist, style=super, shortcuts]{glossaries}
\setlength{\glsdescwidth}{0.9\textwidth}
\makeglossaries
\glsnoexpandfields
\newcommand*{\providedIndex}{i} % default index
\newglossaryentry{Fi}{
name = \ensuremath{F_{i}},
text = \ensuremath{F_{\providedIndex}},
description = Force in cross-section i
}
% modify the entry's format
\defglsentryfmt{%
\let\orgprovidedIndex\providedIndex
\ifdefempty\glsinsert
{}%
{%
\let\providedIndex\glsinsert
\let\glsinsert\relax
}%
\glsgenentryfmt
\let\providedIndex\orgprovidedIndex
}
\begin{document}
\printglossary
\section{Text}
There are three cross-sections.
The force in cross-section 1: $\gls{Fi}[1] = 10 kN$.
The force in cross-section 2: $\gls{Fi}[2] = 15 kN$.
The force in cross-section 3: $\gls{Fi}[3] = 20 kN$.
\end{document}
该代码产生的输出与我的问题中描述的完全一致。