| 1 |
% arara: pdflatex |
| 2 |
% arara: makeglossaries |
| 3 |
% arara: pdflatex |
| 4 |
% arara: makeindex |
| 5 |
% arara: pdflatex |
| 6 |
\documentclass{report} |
| 7 |
|
| 8 |
\usepackage[T1]{fontenc} |
| 9 |
|
| 10 |
\usepackage{makeidx} |
| 11 |
\usepackage[abbreviations,counter=chapter,nopostdot=false]{glossaries-extra} |
| 12 |
|
| 13 |
\renewcommand*{\abbreviationsname}{List of Abbreviations} |
| 14 |
\renewcommand*{\glossarypreamble}{\emph{Numbers refer to the |
| 15 |
\textbf{chapter} where the entry was referenced.}} |
| 16 |
|
| 17 |
\makeindex |
| 18 |
\makeglossaries |
| 19 |
|
| 20 |
% Automatically index the location of entry in the glossary |
| 21 |
% for those entries that are in the "general" category: |
| 22 |
|
| 23 |
\glssetcategoryattribute{general}{indexname}{textbf} |
| 24 |
\glssetcategoryattribute{general}{dualindex}{true} |
| 25 |
|
| 26 |
% Only index first use for the glossary location lists |
| 27 |
% (doesn't affect the indexing from "dualindex" attribute): |
| 28 |
%\glssetcategoryattribute{general}{indexonlyfirst}{true} |
| 29 |
|
| 30 |
% Automatically index the location of entry in the glossary |
| 31 |
% for those entries that are in the "abbreviation" category |
| 32 |
% and use "textbf" as the encap: |
| 33 |
|
| 34 |
\glssetcategoryattribute{abbreviation}{indexname}{textbf} |
| 35 |
\glssetcategoryattribute{abbreviation}{dualindex}{true} |
| 36 |
|
| 37 |
% Only index first use for the glossary location lists |
| 38 |
% (doesn't affect the indexing from "dualindex" attribute): |
| 39 |
%\glssetcategoryattribute{abbreviation}{indexonlyfirst}{true} |
| 40 |
|
| 41 |
% Convert the first letter of the name to upper case in the |
| 42 |
% glossary for general entries: |
| 43 |
\glssetcategoryattribute{general}{glossname}{firstuc} |
| 44 |
|
| 45 |
% Allow "format" key to override "dualindex" attribute. |
| 46 |
\GlsXtrEnableIndexFormatOverride |
| 47 |
|
| 48 |
% use first field instead of name field |
| 49 |
\renewcommand*{\glsxtrautoindexentry}[1]{\string\glsentryfirst{#1}} |
| 50 |
|
| 51 |
% use long form for the sort value, if provided: |
| 52 |
\renewcommand*{\glsxtrautoindexassignsort}[2]{% |
| 53 |
\ifglshaslong{#2}% |
| 54 |
{\glsletentryfield{#1}{#2}{long}}% |
| 55 |
{\glsletentryfield{#1}{#2}{sort}}% |
| 56 |
} |
| 57 |
|
| 58 |
% Define general entries: |
| 59 |
|
| 60 |
\newglossaryentry{duck}{name=duck,% |
| 61 |
description={a waterbird with webbed feet}} |
| 62 |
|
| 63 |
\newglossaryentry{parrot}{name=parrot,% |
| 64 |
description={mainly tropical bird with bright plumage}} |
| 65 |
|
| 66 |
\newglossaryentry{at}{name={@},% |
| 67 |
description={makeindex's default for the ``actual value''}} |
| 68 |
|
| 69 |
\newglossaryentry{esc}{name={"},% |
| 70 |
description={makeindex's default for the ``escape value''}} |
| 71 |
|
| 72 |
\newglossaryentry{level}{name={!},% |
| 73 |
description={makeindex's default for the ``level value''}} |
| 74 |
|
| 75 |
\newglossaryentry{encap}{name={|},% |
| 76 |
description={makeindex's default for the ``encap value''}} |
| 77 |
|
| 78 |
% Set abbreviation style: |
| 79 |
|
| 80 |
\setabbreviationstyle{long-short-sc} |
| 81 |
|
| 82 |
% Define abbreviations: |
| 83 |
|
| 84 |
\newabbreviation |
| 85 |
{html}% identifying label |
| 86 |
{html}% short form |
| 87 |
{hypertext markup language}% long form |
| 88 |
|
| 89 |
\newabbreviation |
| 90 |
{xml}% identifying label |
| 91 |
{xml}% short form |
| 92 |
{extensible markup language}% long form |
| 93 |
|
| 94 |
\title{Sample document testing the glossaries-extra package} |
| 95 |
\author{Nicola Talbot} |
| 96 |
|
| 97 |
\begin{document} |
| 98 |
\maketitle |
| 99 |
|
| 100 |
\chapter{Introduction} |
| 101 |
|
| 102 |
This is a sample\index{sample} document testing the |
| 103 |
\texttt{glossaries-extra} package. |
| 104 |
|
| 105 |
\chapter{General Entries} |
| 106 |
|
| 107 |
Sample entries: \gls{duck} and \gls{parrot}. |
| 108 |
|
| 109 |
Test makeindex's special characters: \gls{at} (actual) |
| 110 |
\gls{esc} (escape) \gls{level} (level) and \gls{encap} (encap). |
| 111 |
|
| 112 |
\chapter{Abbreviations} |
| 113 |
|
| 114 |
First use: \gls{html} and \gls{xml}. |
| 115 |
|
| 116 |
Next use: \gls{html} and \gls{xml}. |
| 117 |
|
| 118 |
\newpage |
| 119 |
|
| 120 |
Uses some entries again: \gls{duck} and \gls[format=textit]{parrot}. |
| 121 |
|
| 122 |
\printglossaries |
| 123 |
|
| 124 |
\printindex |
| 125 |
|
| 126 |
\end{document} |
| 127 |
|