重置词汇表 glsdisplayfirst

重置词汇表 glsdisplayfirst

我正在撰写一篇论文,论文开头包含摘要,我想以glsdisplayfirst某种方式重置属性,以便我的词汇表条目和缩写词在摘要和文档本身中都有定义。我似乎找不到办法做到这一点,所以非常感谢您的帮助。

例子:

\documentclass[oneside]{article}
\usepackage[nonumberlist,acronym]{glossaries}

\DeclareRobustCommand{\glossfirstformat}[1]{\textit{#1}}
\renewcommand*{\glsdisplayfirst}[4]{\glossfirstformat{#1#4}}
\makeglossaries

\newglossaryentry{term}{name={Term}, text={term}, description={A term that obviously needs explaining in the glossary}}
\newacronym{test}{TIAT}{This Is A Test}

\begin{document}

\section{Summary}
The first occurence of \gls{term} should be \textit{italic}. 
The second occurence of \gls{term} shouldn't, though. 

The full definition of \gls{test} should show just the first time, and the abbreviation afterwards, like this: \gls{test}.

\section{Rest}
The first occurence of \gls{term} should - again - be \textit{italic}. 
The rest of the occurences of \gls{term} throughout the rest of the document shouldn't, though. 

The full definition of \gls{test} should - again - show just the first time, and the abbreviation afterwards, like this: \gls{test}.

\printglossaries

\end{document}

答案1

该包glossaries提供了一个名为的宏\glsresetall。它正好可以满足您的要求。

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex

\documentclass[oneside]{article}
\usepackage[nonumberlist,acronym]{glossaries}

\DeclareRobustCommand{\glossfirstformat}[1]{\textit{#1}}
\renewcommand*{\glsdisplayfirst}[4]{\glossfirstformat{#1#4}}
\makeglossaries

\newglossaryentry{term}{name={Term}, text={term}, description={A term that obviously needs explaining in the glossary}}
\newacronym{test}{TIAT}{This Is A Test}

\begin{document}
\section{Summary}
The first occurence of \gls{term} should be \textit{italic}. 
The second occurence of \gls{term} shouldn't, though. 

The full definition of \gls{test} should show just the first time, and the abbreviation afterwards, like this: \gls{test}.
\glsresetall
\section{Rest}
The first occurence of \gls{term} should - again - be \textit{italic}. 
The rest of the occurences of \gls{term} throughout the rest of the document shouldn't, though. 

The full definition of \gls{test} should - again - show just the first time, and the abbreviation afterwards, like this: \gls{test}.

\section{Reset one}
\glsreset{test}
You can also only reset the \gls{test} entry which should now display the full definition, the \gls{term} entry should not be affected.

\printglossaries
\end{document}

在此处输入图片描述

相关内容