Version 4.16 of glossaries now has a hook \glswriteentry that's used to determine whether or not to performing the indexing for commands like \gls. The default definition is:
\newcommand*{\glswriteentry}[2]{%
\ifglsindexonlyfirst
\ifglsused{#1}{}{#2}%
\else
#2%
\fi
}
The first argument is the entry's label and the second argument is the code that actually performs the indexing, so the default definition checks the indexonlyfirst package option and only does #2 on first use if indexonlyfirst=true.
If you simply want to switch off the indexing at the start of the glossaries, you can redefine \glswriteentry to do nothing just before \printglossaries:
\renewcommand*{\glswriteentry}[2]{}
You can also use this mechanisms for more complex situations, such as first use only indexing for a particular glossary type:
\renewcommand*{\glswriteentry}[2]{%
\ifthenelse{\equal{\glsentrytype{#1}}{acronym}}
{\ifglsused{#1}{}{#2}}%
{#2}%
}
Alternatively, you could adapt the sample-chap-hyperfirst.tex example so that it also only performs the indexing once per chapter.
If you want to add a new key, as in the other answer, you can test for the key's setting within \glswriteentry. For example:
\define@boolkey{glslink}{index}[true]{}
\KV@glslink@indexfalse
\renewcommand*{\glswriteentry}[2]{\ifKV@glslink@index #2\fi}
(This would need to go in a package or be placed between \makeatletter and \makeatother.) Since the default value is set to false, no indexing will occur unless you explicitly switch it on using \gls[index]{label} (or similar).
Note that \glswriteentry isn't used by \glsadd (or \glsaddall) since the whole purpose of \glsadd is to add indexing information.
Update:
The glossaries-extra package, which extends the glossaries package provides the noindex key (the negation of the above index key). It also provides a method of applying indexonlyfirst to particular entry categories.
Note that glossaries-extra provides a new (more flexible) mechanism for abbreviations. If you want to continue using \newacronym, you'll need to set the style using:
\setabbreviationstyle[acronym]{long-short}
Alternatively, replace \newacronym with \newabbreviation.
For example, apply indexonlyfirst to just acronyms:
\documentclass{scrartcl}
\usepackage{blindtext}
\usepackage{hyperref}
\usepackage[xindy]{glossaries-extra}
\makeglossaries
\glssetcategoryattribute{acronym}{indexonlyfirst}{true}
\newglossaryentry{ex}{name={sample},description={an example}}
\newglossaryentry{oe}{name={{\"o}l},description={{\"O}l}}
\setabbreviationstyle[acronym]{long-short}
\newacronym{svm}{SVM}{support vector machine}
\begin{document}
\gls{ex} liegt im \gls{oe}.
First use: \gls{svm}. Second use: \gls{svm}.
\Blindtext[2][3]
\gls{svm}
\printglossaries
\end{document}
Alternatively, switching from \newacronym to \newabbreviation:
\documentclass{scrartcl}
\usepackage{blindtext}
\usepackage{hyperref}
\usepackage[xindy]{glossaries-extra}
\makeglossaries
\glssetcategoryattribute{abbreviation}{indexonlyfirst}{true}
\newglossaryentry{ex}{name={sample},description={an example}}
\newglossaryentry{oe}{name={{\"o}l},description={{\"O}l}}
\newabbreviation{svm}{SVM}{support vector machine}
\begin{document}
\gls{ex} liegt im \gls{oe}.
First use: \gls{svm}. Second use: \gls{svm}.
\Blindtext[2][3]
\gls{svm}
\printglossaries
\end{document}
The indexing can be suppressed for a particular entry using \gls[noindex]{svm}. Instead of using indexonlyfirst, you can set noindex=true as the default:
\GlsXtrSetDefaultGlsOpts{noindex}
This means that now \gls etc won't automatically index the entry unless this new default is explicitly overridden in the optional argument, for example \gls[noindex=false]{svm}. This is useful if the first use isn't the most important use. Since it's a bit cumbersome to write [noindex=false], you can set up a shortcut using \GlsXtrSetAltModifier. This allows you to set up a third modifier (in addition to * and +) for commands like \gls. For example:
\GlsXtrSetAltModifier{>}{noindex=false}
This means that \gls>{svm} is now equivalent to \gls[noindex=false]{svm}. You can use another character if you prefer, but it may only be a single character (and you need to be careful of changing category codes).
The following indexes the first use of oe and svm but the second use of ex:
\documentclass{scrartcl}
\usepackage{blindtext}
\usepackage{hyperref}
\usepackage[xindy]{glossaries-extra}
\makeglossaries
\GlsXtrSetDefaultGlsOpts{noindex}
\GlsXtrSetAltModifier{>}{noindex=false}
\newglossaryentry{ex}{name={sample},description={an example}}
\newglossaryentry{oe}{name={{\"o}l},description={{\"O}l}}
\newabbreviation{svm}{SVM}{support vector machine}
\begin{document}
\gls{ex} liegt im \gls>{oe}.
First use: \gls>{svm}. Second use: \gls{svm}.
\Blindtext[2][3]
\gls{svm}, \gls>{ex}.
\printglossaries
\end{document}
pdflatex, too. – Dirk May 25 '15 at 11:02\glshyperlink{}. Unfortunately, it does not work like\gls{}e.g. on the first use of an acronym. – Dirk May 26 '15 at 11:38Is it possible to display specific locations in the glossary?correctly... Any chance your instances of a redefined command such as\gls[yes]{term}that would require a hyper-linked page reference vs\gls[no]{term}could correspond with two distinct types of glossary tables? i.e. definitions that have linked page usages, vs abbreviations, nomenclature, or symbols that don't because there would be too many? If this is the case you can easily modify custom display styles to include or exclude the page numbers... Happy to help, so if I misunderstand, please expand. – EngBIRD Jun 10 '15 at 03:09nonumberlisthides all page numbers. Otherwise, it would be possible to define your solution. – Dirk Jun 11 '15 at 05:52nonumberlist. – Dirk Jun 17 '15 at 08:17