我想知道词汇表如何处理缩写前的冠词“a”。例如,
福克斯·穆德联邦调查局毕业于牛津大学的特工,他相信外星人的存在以及政府隐瞒有关外星人的真相的阴谋。
但是,如果我稍后使用词汇表缩写 FBI,它将显示为:
达娜·史卡利联邦调查局特工、医生和科学家,是穆德的搭档。与他的轻信相反,史考利是一个怀疑论者,她的观点基于科学解释。
如果我将第二条语句上移,它将显示为:
史卡利联邦调查局特工、医生和科学家,是穆德的搭档。与他的轻信相反,史考利是一个怀疑论者,她的观点基于科学解释。
如何使用词汇表来防止这种情况发生?
平均能量损失
\documentclass{article}
\usepackage{glossaries}
\newacronym{fbi}{FBI}{Federal Bureau of Investigation}
\begin{document}
Fox Mulder is a \gls{fbi} special agent educated at Oxford
who believes in the existence of extraterrestrials and a
government conspiracy to hide the truth regarding them.
Dana Scully is an \gls{fbi} special agent, a medical doctor,
and scientist who is Mulder's partner. In contrast to his
credulity, Scully is a skeptic, basing her beliefs on
scientific explanations.
\end{document}
答案1
您可以使用包glossaries-prefix
中提供的glossaries
:
\documentclass{article}
\usepackage{glossaries-prefix}
\newacronym[
prefixfirst={a\ },% prefix used on first use
prefix={an\ }% prefix used on subsequent use
]
{fbi}{FBI}{Federal Bureau of Investigation}
\begin{document}
Fox Mulder is \pgls{fbi} special agent educated at Oxford
who believes in the existence of extraterrestrials and a
government conspiracy to hide the truth regarding them.
Dana Scully is \pgls{fbi} special agent, a medical doctor,
and scientist who is Mulder's partner. In contrast to his
credulity, Scully is a skeptic, basing her beliefs on
scientific explanations.
\end{document}
该glossaries-prefix
包加载glossaries
并添加了四个新键:prefix
、prefixplural
和。您可以使用以下方法确定是否prefixfirst
已为特定条目提供了该字段prefixfirstplural
prefix
\ifglshasprefix{
标签}{
真的}{
错误的}
。这将测试prefix
字段是否为空。其他前缀字段也有类似的命令。
命令\pgls
¹具有与Ulrike的答案相同的语法\gls
并执行相同的测试,因此\pgls{fbi}
本质上与
\ifglsused{fbi}{\glsentryprefix{fbi}}{\glsentryprefixfirst{fbi}}\gls{fbi}
但使用起来更方便。
请注意,前缀和之间不会自动插入空格,\gls
以允许使用prefix={l'}
法语中的类似内容。如果您想要第二组前缀,则必须使用\glsaddkey
并定义类似于的命令手动添加字段\pgls
。
¹ 大写和复数变体也类似。请参阅glossaries
用户手册以获取提供的命令的完整列表。
答案2
您可以测试某个条目是否已被使用:
\documentclass{article}
\usepackage{glossaries}
\newacronym{fbi}{FBI}{Federal Bureau of Investigation}
\begin{document}
Fox Mulder is \ifglsused{fbi}{an}{a} \gls{fbi} special agent educated at Oxford
who believes in the existence of extraterrestrials and a
government conspiracy to hide the truth regarding them.
Dana Scully is \ifglsused{fbi}{an}{a} \gls{fbi} special agent, a medical doctor,
and scientist who is Mulder's partner. In contrast to his
credulity, Scully is a skeptic, basing her beliefs on
scientific explanations.
\end{document}