%%
%% This is file `glossary-bookindex.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% glossaries-extra.dtx  (with options: `glossary-bookindex.sty,package')
%% 
%%  glossaries-extra.dtx
%%  Copyright 2022 Nicola Talbot
%% 
%%  This work may be distributed and/or modified under the
%%  conditions of the LaTeX Project Public License, either version 1.3
%%  of this license or (at your option) any later version.
%%  The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%%  and version 1.3 or later is part of all distributions of LaTeX
%%  version 2005/12/01 or later.
%% 
%%  This work has the LPPL maintenance status `maintained'.
%% 
%%  The Current Maintainer of this work is Nicola Talbot.
%% 
%%  This work consists of the files glossaries-extra.dtx and glossaries-extra.ins and the derived files glossaries-extra.sty, glossaries-extra-abbrstyles.def, glossaries-extra-bib2gls.sty, glossaries-extra-stylemods.sty, glossary-bookindex.sty, glossary-longextra.sty, glossary-topic.sty, glossary-table.sty, example-glossaries-xr.tex, example-glossaries-acronym-desc.bib, example-glossaries-acronym.bib, example-glossaries-acronyms-lang.bib, example-glossaries-brief.bib, example-glossaries-childmultipar.bib, example-glossaries-childnoname.bib, example-glossaries-cite.bib, example-glossaries-images.bib, example-glossaries-long.bib, example-glossaries-longchild.bib, example-glossaries-multipar.bib, example-glossaries-parent.bib, example-glossaries-symbolnames.bib, example-glossaries-symbols.bib, example-glossaries-url.bib, example-glossaries-user.bib, example-glossaries-xr.bib, glossaries-extra-2021-11-22.sty, glossaries-extra-bib2gls-2021-11-22.sty, glossaries-extra-stylemods-2021-11-22.sty, glossary-bookindex-2021-11-22.sty, glossary-longextra-2021-11-22.sty, glossary-topic-2021-11-22.sty.
%% 
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
\NeedsTeXFormat{LaTeX2e}
\DeclareRelease{v1.48}{2021-11-22}{glossary-bookindex-2021-11-22.sty}
\DeclareCurrentRelease{v1.50}{2022-11-08}
\ProvidesPackage{glossary-bookindex}[2022/11/08 v1.50 (NLCT)]
\RequirePackage{multicol}
\RequirePackage{glossary-tree}
\newcommand{\glsxtrbookindexcols}{2}
\newcommand*{\glsxtrbookindexname}[1]{\glossentryname{#1}}
\newcommand*{\glsxtrbookindexsubname}[1]{\glsxtrbookindexname{#1}}
\providecommand*{\glsxtrprelocation}{\space}

\newcommand*{\glsxtrbookindexprelocation}[1]{%
  \glsxtrifhasfield{location}{#1}%
  {,\glsxtrprelocation}%
  {\glsxtrprelocation}%
}
\newcommand*{\glsxtrbookindexsubprelocation}[1]{%
 \glsxtrbookindexprelocation{#1}%
}
\newcommand*{\glsxtrbookindexlocation}[2]{#2}
\newcommand*{\glsxtrbookindexsublocation}{\glsxtrbookindexlocation}
\newcommand{\glsxtrbookindexparentchildsep}{\nopagebreak}
\newcommand{\glsxtrbookindexparentsubchildsep}{\glsxtrbookindexparentchildsep}
\newcommand{\glsxtrbookindexbetween}[2]{}
\newcommand{\glsxtrbookindexsubbetween}[2]{}
\newcommand{\glsxtrbookindexsubsubbetween}[2]{}
\newcommand{\glsxtrbookindexatendgroup}[1]{}
\newcommand{\glsxtrbookindexsubatendgroup}[1]{}
\newcommand{\glsxtrbookindexsubsubatendgroup}[1]{}
\newcommand{\glsxtrbookindexgroupskip}{\ifglsnogroupskip\else\indexspace\fi}
\newcommand{\glsxtrbookindexpregroupskip}[1]{#1}
\newcommand{\glsxtrbookindexpostgroupskip}{\indexspace}
\newcommand{\glsxtrbookindexpresubgroupskip}[3]{\par\medskip}
\newcommand{\glsxtrbookindexpostsubgroupskip}[2]{\par\medskip}
\newcommand*{\glsxtrbookindexformatheader}[1]{%
  \par{\centering\glstreegroupheaderfmt{#1}\par}%
}
\newcommand*{\glsxtrbookindexformatsubheader}[5]{%
 \ifnum#2>1\relax
  \glstreesubsubitem\glstreegroupheaderfmt{#5}%
 \else
  \glstreesubitem\glstreegroupheaderfmt{#5}%
 \fi
}
\ifdef\pdfbookmark
{%
  \newcommand*{\glsxtrbookindexbookmark}[2]{%
    \ifdefstring{\@@glossarysec}{chapter}%
    {\pdfbookmark[1]{#1}{#2}}%
    {\pdfbookmark[2]{#1}{#2}}%
  }
}
{%
  \newcommand*{\glsxtrbookindexbookmark}[2]{}
}
\ifdef\pdfbookmark
{%
  \newcommand*{\glsxtrbookindexsubbookmark}[3]{%
    \ifdefstring{\@@glossarysec}{chapter}%
    {\expandafter\pdfbookmark\expandafter[\number\numexpr#1+1]{#3}{#2}}%
    {\expandafter\pdfbookmark\expandafter[\number\numexpr#1+2]{#3}{#2}}%
  }
}
{%
  \newcommand*{\glsxtrbookindexsubbookmark}[3]{}
}
\newcommand*{\glsxtrbookindexbookmarkprefix}{\currentglossary.}
\newcommand*{\glsxtrbookindexcolspread}{}
\newcommand*{\glsxtrbookindexmulticolsenv}{multicols}
\newglossarystyle{bookindex}{%
  \setglossarystyle{index}%
  \renewenvironment{theglossary}%
  {%
    \ifnum\glsxtrbookindexcols>1\relax
      \ifdefempty\glsxtrbookindexcolspread
      {%
        \edef\glsxtr@beginbookindex{%
          \noexpand\begin{\glsxtrbookindexmulticolsenv}
            {\glsxtrbookindexcols}%
        }%
      }%
      {%
        \edef\glsxtr@beginbookindex{%
          \noexpand\begin{\glsxtrbookindexmulticolsenv}%
            {\glsxtrbookindexcols}[\glsxtrbookindexcolspread]%
        }%
      }%
    \else
      \def\glsxtr@beginbookindex{}%
    \fi
    \glsxtr@beginbookindex
    \setlength{\parindent}{0pt}%
    \setlength{\parskip}{0pt plus 0.3pt}%
    \let\@glsxtr@bookindex@sep\glsxtrbookindexparentchildsep
    \let\@glsxtr@bookindex@subsep\glsxtrbookindexparentsubchildsep
    \let\@glsxtr@bookindex@between\@gobble
    \let\@glsxtr@bookindex@subbetween\@gobble
    \let\@glsxtr@bookindex@subsubbetween\@gobble
    \let\@glsxtr@bookindex@atendgroup\relax
    \let\@glsxtr@bookindex@subatendgroup\relax
    \let\@glsxtr@bookindex@subsubatendgroup\relax
    \let\@glsxtr@bookindexgroupskip\relax
  }%
  {%
     \@glsxtr@bookindex@subsubatendgroup
     \@glsxtr@bookindex@subatendgroup
     \@glsxtr@bookindex@atendgroup
    \ifnum\glsxtrbookindexcols>1\relax
      \edef\glsxtr@endbookindex{%
        \noexpand\end{\glsxtrbookindexmulticolsenv}%
      }%
    \else
      \def\glsxtr@endbookindex{}%
    \fi
    \glsxtr@endbookindex
  }%
  \renewcommand*{\glossaryheader}{\raggedright}%
  \renewcommand*{\glossentry}[2]{%
    \@glsxtr@bookindex@between{##1}%
    \let\@glsxtr@bookindex@sep\glsxtrbookindexparentchildsep
    \let\@glsxtr@bookindex@subsep\glsxtrbookindexparentsubchildsep
    \let\@glsxtr@bookindex@subbetween\@gobble
    \let\@glsxtr@bookindex@subsubbetween\@gobble
    \protected@edef\@glsxtr@bookindex@between{%
       \noexpand\glsxtrbookindexbetween{##1}%
    }%
    \protected@edef\@glsxtr@bookindex@atendgroup{%
      \noexpand\glsxtrbookindexatendgroup{##1}%
    }%
    \let\@glsxtr@bookindex@subatendgroup\relax
    \let\@glsxtr@bookindex@subsubatendgroup\relax
    \glstreeitem
      \glsentryitem{##1}%
      \glstarget{##1}{\glsxtrbookindexname{##1}}%
    \glsxtrbookindexprelocation{##1}%
    \glsxtrbookindexlocation{##1}{##2}%
  }%
  \renewcommand{\subglossentry}[3]{%
    \ifcase##1\relax
      \glstreeitem
    \or
      \@glsxtr@bookindex@sep
      \@glsxtr@bookindex@subbetween{##2}%
      \let\@glsxtr@bookindex@sep\relax
      \let\@glsxtr@bookindex@subsubbetween\@gobble
      \let\@glsxtr@bookindex@subsep\glsxtrbookindexparentsubchildsep
      \edef\@glsxtr@bookindex@subbetween{%
         \noexpand\glsxtrbookindexsubbetween{##2}%
      }%
      \edef\@glsxtr@bookindex@atsubendgroup{%
        \noexpand\glsxtrbookindexatsubendgroup{##1}%
      }%
      \glstreesubitem
      \glssubentryitem{##2}%
    \else
      \@glsxtr@bookindex@subsep
      \@glsxtr@bookindex@subsubbetween{##2}%
      \let\@glsxtr@bookindex@subsep\relax
      \edef\@glsxtr@bookindex@subsubbetween{%
         \noexpand\glsxtrbookindexsubsubbetween{##2}%
      }%
      \edef\@glsxtr@bookindex@atsubsubendgroup{%
        \noexpand\glsxtrbookindexatsubsubendgroup{##1}%
      }%
      \glstreesubsubitem
    \fi
    \glstarget{##2}{\glsxtrbookindexsubname{##2}}%
    \glsxtrbookindexsubprelocation{##2}%
    \glsxtrbookindexsublocation{##2}{##3}%
  }%
  \renewcommand*{\glsgroupskip}{}%
  \renewcommand*{\glsgroupheading}[1]{%
    \@glsxtr@bookindex@subsubatendgroup
    \@glsxtr@bookindex@subatendgroup
    \@glsxtr@bookindex@atendgroup
    \glsxtrbookindexpregroupskip\@glsxtr@bookindexgroupskip
    \let\@glsxtr@bookindexgroupskip\glsxtrbookindexgroupskip
    \let\@glsxtr@bookindex@between\@gobble
    \let\@glsxtr@bookindex@atendgroup\relax
    \let\@glsxtr@bookindex@subatendgroup\relax
    \let\@glsxtr@bookindex@subsubatendgroup\relax
    \glsxtrgetgrouptitle{##1}{\glsxtrcurrentgrptitle}%
    \glsxtrbookindexbookmark{\glsxtrcurrentgrptitle}{\glsxtrbookindexbookmarkprefix##1}%
    \glsxtrbookindexformatheader{\glsxtrcurrentgrptitle}%
    \nopagebreak\glsxtrbookindexpostgroupskip\nopagebreak\@afterheading
  }%
  \renewcommand*{\glssubgroupheading}[4]{%
    \@glsxtr@bookindex@subsubatendgroup
    \@glsxtr@bookindex@subatendgroup
    \@glsxtr@bookindex@atendgroup
    \glsxtrbookindexpresubgroupskip\@glsxtr@bookindexgroupskip{##1}{##2}%
    \let\@glsxtr@bookindexgroupskip\glsxtrbookindexgroupskip
    \let\@glsxtr@bookindex@between\@gobble
    \let\@glsxtr@bookindex@atendgroup\relax
    \let\@glsxtr@bookindex@subatendgroup\relax
    \let\@glsxtr@bookindex@subsubatendgroup\relax
    \glsxtrgetgrouptitle{##4}{\glsxtrcurrentgrptitle}%
    \glsxtrbookindexsubbookmark{##2}{##4}{\glsxtrcurrentgrptitle}%
    \glsxtrbookindexformatsubheader{##1}{##2}{##3}{##4}{\glsxtrcurrentgrptitle}%
    \nopagebreak\glsxtrbookindexpostsubgroupskip{##1}{##2}\nopagebreak\@afterheading
  }
}
\newcommand{\glsxtrbookindexthepage}{%
 \ifdef\currentglossary{\currentglossary.\arabic{page}}{\arabic{page}}%
}
\newcommand*{\glsxtrbookindexmarkentry}[1]{%
  \protected@write\@auxout
  {\let\glsxtrbookindexthepage\relax}%
  {\string\glsxtr@setbookindexmark{\glsxtrbookindexthepage}{#1}}%
}
\newcommand*{\glsxtr@setbookindexmark}[2]{%
 \ifcsundef{glsxtr@idxfirstmark@#1}%
 {\csgdef{glsxtr@idxfirstmark@#1}{#2}}%
 {}%
 \csgdef{glsxtr@idxlastmark@#1}{#2}%
}
\newcommand*{\glsxtrbookindexfirstmarkfmt}[1]{%
  \glsentryname{#1}%
}
\newcommand*{\glsxtrbookindexfirstmark}{%
  \letcs{\glsxtr@label}{glsxtr@idxfirstmark@\glsxtrbookindexthepage}%
  \ifdef\glsxtr@label
  {\glsxtrbookindexfirstmarkfmt{\glsxtr@label}}%
  {}%
}
\newcommand*{\glsxtrbookindexlastmarkfmt}[1]{%
  \glsentryname{#1}%
}
\newcommand*{\glsxtrbookindexlastmark}{%
  \letcs{\glsxtr@label}{glsxtr@idxlastmark@\glsxtrbookindexthepage}%
  \ifdef\glsxtr@label
  {\glsxtrbookindexlastmarkfmt{\glsxtr@label}}%
  {}%
}
\endinput
%%
%% End of file `glossary-bookindex.sty'.
