答案1
如果您的first
和text
值相同,则可以使用以下方法实现此目的:
\documentclass{report}
\usepackage{etoolbox}
\usepackage[colorlinks]{hyperref}
\usepackage
[
nohypertypes={main}% suppress automatic links for main glossary
]
{glossaries}
% reset entries at the start of each chapter
\preto\chapter{\glsresetall}
\makeglossaries
% Modify the way `\gls`, `\glspl` (and their case-changing versions)
% and `\glsdisp` appear:
\renewcommand{\glsentryfmt}{%
\ifglsused{\glslabel}
{\glsgenentryfmt}% entry has been used.
{\glshyperlink[\glsgenentryfmt]{\glslabel}}% entry hasn't been used
}
\newglossaryentry{apple}{
name={apple},
description={small round fruit}
}
\newglossaryentry{pear}{
name={pear},
description={small non-round fruit}
}
\begin{document}
\chapter{Sample}
\section{No Case Change}
Singular: \gls{apple}. Plural: \glspl{apple}.
Singular: \gls{pear}. Plural: \glspl{pear}.
\section{First Letter Uppercase}
Singular: \Gls{apple}. Plural: \Glspl{apple}.
Singular: \Gls{pear}. Plural: \Glspl{pear}.
\section{All Uppercase}
Singular: \GLS{apple}. Plural: \GLSpl{apple}.
Singular: \GLS{pear}. Plural: \GLSpl{pear}.
\chapter{Another Sample}
\section{No Case Change}
Singular: \gls{apple}. Plural: \glspl{apple}.
Singular: \gls{pear}. Plural: \glspl{pear}.
\section{First Letter Uppercase}
Singular: \Gls{apple}. Plural: \Glspl{apple}.
Singular: \Gls{pear}. Plural: \Glspl{pear}.
\section{All Uppercase}
Singular: \GLS{apple}. Plural: \GLSpl{apple}.
Singular: \GLS{pear}. Plural: \GLSpl{pear}.
\printglossaries
\end{document}
第一页:
第二页:
词汇表:
如果您有任何缩写,则此方法将在每章开始时重置它们。如果您不希望发生这种情况,则代码将需要进行一些修改。