I would like to incorporate the suggested solution by Herbert, that can be found HERE, within certain glossary records.
Consider the following example:
\documentclass[a4paper]{book}
\usepackage{glossaries}
\makeglossaries
\makeatletter
\newcommand{\fs}{\@ifnextchar.{}{.}}% test of next token
\makeatother
\newglossaryentry{pg}{
name={pg.},
description={pg.},
first={pg.},
firstplural={pp.},
plural={pp.}
}
\newglossaryentry{fig}{
name={fig.},
description={fig.},
first={fig.},
firstplural={figs.},
plural={figs.}
}
\begin{document}
as can be seen in the \glspl{fig} on the following \gls{pg}.
\end{document}
Which typesets without issue, however it creates a double dot at the end of the sentence.
A solution that I had in mind would be to try and put the defined macro \fs into the glossary records, however errors get returned, ie, the following causes the above to not compile:
\newglossaryentry{pg}{
name={pg\fs},
description={pg\fs},
first={pg\fs},
firstplural={pp\fs},
plural={pp\fs}
}
Another approach could be to modify the \gls{...} and similar commands, to check if the evaluated record ends in a '.', and if so, replace by the \fs macro, but there are many commands as part of the glossaries package, not sure how to do it this way.
How can this be achieved. I use glossaries as a means to host many such abbreviations on a document-wide basis.



\DeclareRobustCommand{\fs}{\@ifnextchar.{}{.}}. However, this doesn't help with eating the dot though. – Andrew Swann Jun 17 '13 at 16:13