% This file is public domain.
% If you want to use arara you need the following directives:
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
%
%http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#sample-dot-abbr
\documentclass{article}

\usepackage{glossaries}

\makeglossaries

\glsaddstoragekey{abbrtype}{word}{\abbrtype}

\setacronymstyle{long-short}

\newcommand*{\newabbr}[1][]{%
 \newacronym[abbrtype=initials,#1]}

\newabbr{eg}{e.g.}{exempli gratia}
\newabbr{ie}{i.e.}{id est}
\newabbr{bsc}{B.Sc.}{Bachelor of Science}
\newabbr{ba}{B.A.}{Bachelor of Arts}
\newabbr{agm}{A.G.M.}{annual general meeting}

\newacronym{laser}{laser}{light amplification by stimulated
emission of radiation}

% See the sample-initialisms.tex example file provided with
% glossaries-extra.sty for a better way of doing this.

\makeatletter
\renewcommand{\glspostlinkhook}{%
 \ifglsfieldeq{\glslabel}{abbrtype}{initials}%
 {\new@ifnextchar.\doendsentence\doendword}
 {}%
}
\makeatother

\newcommand{\doendsentence}[1]{\spacefactor=10000{}}
\newcommand{\doendword}{\spacefactor=1000{}}

\begin{document}
This is a sample document that illustrates abbreviations with
full stops (periods) and abbreviations that are words (i.e.\
acronyms). The examples switch to a typewriter font to make it
easier to see the inter-word and inter-sentence spaces.

The extension package glossaries-extra.sty provides a better way of
doing this.

First use: \gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} end of
sentence.

End of sentence use:

\ttfamily

\gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}.
Done.

laser. e.g. i.e. B.Sc. B.A\@. A.G.M\@. Done.

\rmfamily

Mid-sentence use:

\ttfamily

\gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} Done.

laser e.g.\ i.e.\ B.Sc.\ B.A. A.G.M. Done.

\rmfamily

Check other sentence terminators:

\ttfamily

\gls{laser}? \gls{eg}? \gls{ie}? \gls{bsc}! \gls{ba}! \gls{agm}? Done.

laser? e.g.? i.e.? B.Sc.! B.A.! A.G.M.? Done.

\rmfamily

\glsresetall Reset. End of sentence use:

\ttfamily

\gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}.
Done.

\rmfamily
\printglossaries
\end{document}
