![从词汇表中删除表格列表等条目](https://linux22.com/image/306180/%E4%BB%8E%E8%AF%8D%E6%B1%87%E8%A1%A8%E4%B8%AD%E5%88%A0%E9%99%A4%E8%A1%A8%E6%A0%BC%E5%88%97%E8%A1%A8%E7%AD%89%E6%9D%A1%E7%9B%AE.png)
\documentclass{article}
\usepackage{glossaries}
\makeglossaries
\begin{document}
\listoftables
\printglossaries
\newglossaryentry{example}{
name={example},
description={example}
}
\clearpage
\begin{table}
\begin{tabular}{cccc}
1 & 2 & 3 & 4
\end{tabular}
\caption{\gls{example}}
\end{table}
\end{document}
在上面的示例中,在创建的词汇表中,示例显示存在于两个页面中:其实际用途,以及其在表格列表中提取的标题用途。我知道我可以编辑表格列表的标题等,但我想知道是否有任何选项可以自动完全删除这些条目。
答案1
没有选项可以自动删除这些条目,这就是为什么glossaries
手册警告不要在标题和章节标题中使用这些命令。但是,您可以\gls
在前言中临时重新定义,然后在文档开头重置它,如下所示:
\documentclass{article}
\usepackage{glossaries}
\makeglossaries
\begin{document}
\let\ORGgls\gls
\renewcommand*{\gls}[2][]{\glsentrytext{#2}}
\listoftables
\let\gls\ORGgls
\printglossaries
\newglossaryentry{example}{
name={example},
description={example}
}
\clearpage
\begin{table}
\begin{tabular}{cccc}
1 & 2 & 3 & 4
\end{tabular}
\caption{\gls{example}}
\end{table}
\end{document}