% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[colorlinks]{hyperref}
\usepackage{glossaries-extra}

\makeglossaries

% set up the styles:
\setabbreviationstyle{long-short-sc}

\setabbreviationstyle[initialism]{short-long}
\glssetcategoryattribute{initialism}{insertdots}{true}
\glssetcategoryattribute{initialism}{discardperiod}{true}
\glssetcategoryattribute{initialism}{retainfirstuseperiod}{true}

% define the entries:

\newabbreviation{html}{html}{hypertext markup language}

\newabbreviation[category=initialism]{eg}{eg}{for example}
\newabbreviation[category=initialism]{si}{SI}{sample initials}

\begin{document}
\section{Examples}

Abbreviations with dots \gls{eg} and \gls{si} and abbreviation
without dots \gls{html} and the end of the sentence. 

(Next use.) Abbreviations with dots \gls{eg} and \gls{si} and abbreviation
without dots \gls{html} and the end of the sentence. 

Singular: \gls{si} and at the end of a sentence \gls{si}.

Plural: \glspl{si} and at the end of a sentence \glspl{si}.

Reset\glsresetall. First use end of sentence:
\gls{eg}. \gls{si}. \gls{html}.

Next use end of sentence:
\gls{eg}. \gls{si}. \gls{html}.

\section{Space Factors}

Test the space factors. (More visible if we switch to a monospaced
font.)

\begin{ttfamily}
Initialisms in the middle \gls{eg} and \gls{si} of a sentence.

Initialism at the end of a sentence \gls{eg}.
Initialism at the end of a sentence \gls{si}.
Another sentence.
\end{ttfamily}

Compare with explicitly writing the text without \verb|\gls|
and judicious use of \verb*|\ | and \verb|\@|:

\begin{ttfamily}
Initialisms in the middle e.g.\ and S.I. of a sentence.

Initialism at the end of a sentence e.g.
Initialism at the end of a sentence S.I\@.
Another sentence.
\end{ttfamily}

\printglossaries

\end{document}
