使用该glossaries
软件包并激活 numberlist 后,当我使用 -like 命令引用词汇表的另一个条目中的条目时,我希望避免在 numberlist 中出现引用\gls
。实际上,numberlist 应仅显示主文档中引用相应条目的页面。
下面是一个 MWE,用于演示我想要实现的目标:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[nopostdot,style=indexgroup,nolist]{glossaries}
\makenoidxglossaries
\newglossaryentry{target}
{
name={target},
description={Foo foo bar. Page 2 should not appear here.}
}
\newglossaryentry{link}
{
name={link},
description={This one has a \gls{target}, but this use of \gls{target} should not appear in the numberlist.}
}
\begin{document}
This usage of \gls{target} should appear in the number list.
We also have \glspl{link} here.
\newpage
\printnoidxglossary
\end{document}
答案1
只需使用基础包,glossaries
您就可以使用:\glshyperlink
\gls
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[nopostdot,style=indexgroup,nolist]{glossaries}
\makenoidxglossaries
\newglossaryentry{target}
{
name={target},
description={Foo foo bar. Page 2 should not appear here.}
}
\newglossaryentry{link}
{
name={link},
description={This one has a \glshyperlink{target}, but this use of
\glshyperlink{target} should not appear in the numberlist.}
}
\begin{document}
This usage of \gls{target} should appear in the number list.
We also have \glspl{link} here.
\newpage
\printnoidxglossary
\end{document}
这将从数字列表中省略第 2 页:
如果没有hyperref
,\glshyperlink{label}
实际上就是\glsentrytext{label}
。有了hyperref
,它还会有一个超链接。
随着glossaries-extra
扩展包中,您可以使用选项关闭索引noindex
。(该nopostdot
选项是自动实现的。出于某种原因,glossaries-extra
似乎不喜欢nolist
,所以我删除了它。我会调查一下。)
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[style=indexgroup]{glossaries-extra}
\makenoidxglossaries
\newglossaryentry{target}
{
name={target},
description={Foo foo bar. Page 2 should not appear here.}
}
\newglossaryentry{link}
{
name={link},
description={This one has a \gls{target}, but this use of
\gls{target} should not appear in the numberlist.}
}
\begin{document}
This usage of \gls{target} should appear in the number list.
We also have \glspl{link} here.
\newpage
\GlsXtrSetDefaultGlsOpts{noindex}
\printnoidxglossary
\end{document}
在这两个例子中,如果target
未在文档的其他地方被索引,则不会出现在词汇表中。结果与之前相同。