2010-05-15 65 views
2

我在LaTeX中使用詞彙表軟件包。我在文檔中有\gls{foo},但我不希望「foo」的條目出現在詞彙表中。我如何在文檔正文中保留工作(即擴展)\gls{foo},但從術語表中排除「foo」的條目?從術語表中排除條目?

編輯:我想用\gls{foo}來表示「在此使用,'foo'在本文檔中有其具體含義。」然而,在一些情況下,我最終得到了一個「foo」,其定義太明顯 - 或者說很難 - 在詞彙表中清晰地表達出來。

所以我想\gls{foo}像往常一樣擴大,但我不希望「富」條目出現在術語表中。

我希望這增加了一些關於我想要完成的信息。這可能是詞彙表的濫用,但我發現確保在撰寫技術文檔時始終使用相同的詞彙和正確的詞彙很有幫助。

+2

你能舉個例子說明這會有用嗎?爲什麼不用'foo'替換'\ gls {foo}'?你希望看到的最終效果是什麼? – godbyk 2010-05-15 01:44:17

回答

2

如果您使用的是glossaries包,你可以創建一個「忽略」詞彙表像

\documentclass{article} 

\usepackage{glossaries} 
\newglossary[glignoredl]{ignored}{glignored}{glignoredin}{Ignored Glossary} 
\makeglossaries 

\newglossaryentry{foofoo}{name={FOOFOO},description={foofoo stuff}} 
\newglossaryentry{foo}{name={FOO},type={ignored},description={no good description}} 
\newglossaryentry{bar}{name={BAR},description={bar of stuff}} 

\begin{document} 

Here is a \gls{foo} that is also a \gls{bar}, but of course it's also a \gls{foofoo}. 
Why not consider buying a \gls{foo}? 

\printglossary 
% \printglossary[type={ignored}] 

\end{document} 
+0

這樣做,謝謝! – draebek 2010-05-16 16:02:16

2

我不知道爲什麼你要做到這一點,但下面應該工作:

\let\oldgls\gls% store the original meaning of \gls in a new command named \oldgls 
\let\gls\relax$ make \gls do nothing 
Some text with \gls{foo} no links to the glossary, 
and no ``foo'' entry in the glossary. 
\let\gls\oldgls% restore the original meaning of \gls 
Some more text with \gls{bar} that links to the glossary, 
and with a ``bar'' entry in the glossary. 
+0

'\ gls {foo}'出現在我的文檔中幾十遍。此外,有時「富」是一個不同的詞,但後來成爲「富」,現在我不想在詞彙表中「富」,但我仍然希望它用'\ gls {foo}'來引用(它可能會在未來的某個時候改變自己)。 因此,我更喜歡一個解決方案,不需要我摻雜'\ gls {foo}'的每個用法。 我想應該有一些方法來設置條目,就好像它是「未使用」的時間_something_獲取周圍生成詞彙表。我不介意在最後加上'\ glsignore {foo}'之類的東西。 – draebek 2010-05-15 05:10:37

0

這可以通過將術語添加到特殊的common字典來完成。它實際上是glossaries包的內置功能,甚至是exemplified by the package author。從上述示例中:

\documentclass{article} 

\usepackage{glossaries} 
\newignoredglossary{common} 
\makeglossaries 

\newglossaryentry{sample}{name={sample},description={an example}} 
\newglossaryentry{commonex}{type=common,name={common term}} 

\begin{document} 
\gls{sample}. \gls{commonex}. 
\printglossaries 
\end{document} 

請注意使用\newignoredglossary命令。