通常情况下,glossaries-extra 应该强调文本中第一次出现的词汇表条目。但在我的例子中,它没有这样做,我不明白为什么。
该项目太大,无法全部分享,但我会尝试发布相关的代码行。
%main.tex
\documentclass[fleqn,titlepage]{article}
\usepackage[a4paper, left=30mm,right=20mm,top=20mm,bottom=20mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{siunitx}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[style=numeric-comp,citestyle=numeric-comp,sorting=none]{biblatex}
\usepackage{csquotes}
\usepackage{graphicx}
\usepackage[acronym,symbols,nogroupskip,nonumberlist]{glossaries-extra}
\usepackage[]{hyperref}
\usepackage[nameinlink,noabbrev]{cleveref}
\usepackage{makecell}
\usepackage{array}
\RestoreAcronyms
% \glssetcategoryattribute{general}{textformat}{textit}
\loadglsentries[main]{glossaries/glo.tex}
\makenoidxglossaries
\begin{document}
% BODY
\include{content/theory}
%GLOSSARIES
\pagebreak
\printnoidxglossary[sort=word,style=super]
\pagebreak
\printbibliography[heading=bibintoc,title={References}]
\end{document}
%glo.tex
%\newglossaryentry{linear inverse problem}{name=linear inverse problem,first={\emph{linear inverse problem}},
description={}}
\newglossaryentry{linear inverse problem}{name=linear inverse problem,
description={}}
%theory.tex
\section{Theoretical Framework}
In this section the theoretical framework shall be laid out starting with the information theoretical fundamentals. First, the central \gls{linear inverse problem} is outlined, followed by the algorithm intended to solve it including the employed principles of machine learning. Finally the underlying physical model is introduced.
取消注释\glssetcategoryattribute{general}{textformat}{textit}
会产生您期望的结果:所有出现的项都会被强调。没有注释,第一个就不会被强调。
\glsresetall{}
也不会执行任何操作。但是,指定任何这样的条目\newglossaryentry{linear inverse problem}{name=linear inverse problem,first={\emph{linear inverse problem}}, description={}}
都会强调第一个出现的项。
这是一个错误吗?
答案1
我已经使用解决了这个问题
\defglsentryfmt{%
\ifglsused{\glslabel}{%
\glsgenentryfmt%
}{%
% Typeset first use
\emph{\glsgenentryfmt}%
}%
}
在序言中。我仍然不知道最初是什么导致了它。