% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
% arara: makeindex
% arara: pdflatex
\documentclass{report}

\usepackage[T1]{fontenc}

\usepackage{makeidx}
\usepackage[abbreviations,counter=chapter,nopostdot=false]{glossaries-extra}

\renewcommand*{\abbreviationsname}{List of Abbreviations}
\renewcommand*{\glossarypreamble}{\emph{Numbers refer to the chapter
where the entry was referenced.}}

\makeindex
\makeglossaries

% Automatically index the location of entry in the glossary
% for those entries that are in the "general" category:

\glssetcategoryattribute{general}{indexname}{textbf}
\glssetcategoryattribute{general}{dualindex}{true}

% Only index first use for the glossary location lists
% (doesn't affect the indexing from "dualindex" attribute):
%\glssetcategoryattribute{general}{indexonlyfirst}{true}

% Automatically index the location of entry in the glossary
% for those entries that are in the "abbreviation" category
% and use "textbf" as the encap:

\glssetcategoryattribute{abbreviation}{indexname}{textbf}
\glssetcategoryattribute{abbreviation}{dualindex}{true}

% Only index first use for the glossary location lists
% (doesn't affect the indexing from "dualindex" attribute):
%\glssetcategoryattribute{abbreviation}{indexonlyfirst}{true}

% Convert the first letter of the name to upper case in the 
% glossary for general entries:
\glssetcategoryattribute{general}{glossname}{firstuc}

% Allow "format" key to override "dualindex" attribute.
\GlsXtrEnableIndexFormatOverride

% Define general entries:

\newglossaryentry{duck}{name=duck,%
  description={a waterbird with webbed feet}}

\newglossaryentry{parrot}{name=parrot,%
  description={mainly tropical bird with bright plumage}}

\newglossaryentry{at}{name={@},%
  description={makeindex's default for the ``actual value''}}

\newglossaryentry{esc}{name={"},%
  description={makeindex's default for the ``escape value''}}

\newglossaryentry{level}{name={!},%
  description={makeindex's default for the ``level value''}}

\newglossaryentry{encap}{name={|},%
  description={makeindex's default for the ``encap value''}}

% Set abbreviation style:

\setabbreviationstyle{long-short-sc}

% Define abbreviations:

\newabbreviation
 {html}% identifying label
 {html}% short form
 {hypertext markup language}% long form

\newabbreviation
 {xml}% identifying label
 {xml}% short form
 {extensible markup language}% long form

\title{Sample document testing the glossaries-extra package}
\author{Nicola Talbot}

\begin{document}
\maketitle

\chapter{Introduction}

This is a sample\index{sample} document testing the
\texttt{glossaries-extra} package.

\chapter{General Entries}

Sample entries: \gls{duck} and \gls{parrot}.

Test makeindex's special characters: \gls{at} (actual)
\gls{esc} (escape) \gls{level} (level) and \gls{encap} (encap).

\chapter{Abbreviations}

First use: \gls{html} and \gls{xml}.

Next use: \gls{html} and \gls{xml}.

\newpage

Uses some entries again: \gls{duck} and \gls[format=textit]{parrot}.

\printglossaries

\printindex

\end{document}

