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

\usepackage[T1]{fontenc}% provide bold small caps
\usepackage[utf8]{inputenc}
\usepackage{slantsc}% provide slanted small caps
\usepackage[colorlinks]{hyperref}
\usepackage{glossaries-extra}

\makeglossaries

\setabbreviationstyle{long-short-sc}
\newabbreviation{html}{html}{hypertext markup language}

\newglossaryentry{sample}{name=sample,
 description={an example}}

\pagestyle{headings}

% entries with the headuc attribute set to "true"
% will ensure the \glsfmttext etc commands use the
% upper case version in page headers.
\glssetcategoryattribute{general}{headuc}{true}

% This attribute isn't set for the "abbreviation" category
% which keeps the abbreviation as small caps in the header.

% Uncomment the following to set the attribute for the
% abbreviations as well:
%\glssetcategoryattribute{abbreviation}{headuc}{true}

\begin{document}
\begin{abstract}
This is a sample document that tests the use of entries
in sectioning commands through commands like \verb|\glsfmtshort|
and \verb|\glsfmttext|.
\end{abstract}

\tableofcontents

\chapter{\Glsfmttext{sample} Chapter with \glsfmtshort{html} Abbreviation}
\label{ch:sample}

First use: \gls{html}. Next use: \gls{html}.
Note that the \gls{sample} entry that occurs at the start of
the chapter title appears in lower case in the PDF bookmarks, since
the case-changing command can't be used there.

\newpage

Page break to test header.

\chapter{Another 
  \texorpdfstring{\Glsfmttext{sample}}{Sample} 
  Chapter with \glsfmtshort{html} Abbreviation}

The case-changing commands can't be used in PDF bookmarks,
so this chapter has used \verb|\texorpdfstring| to provide
an alternative for the PDF bookmark. The first chapter
(\nameref{ch:sample})
didn't do this so ``\Gls{sample}'' appeared in lower case in
the PDF bookmark.

\newpage

Page break to test header.

\printglossaries

\end{document}
