%%
%% 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 2018 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-bib2gls.sty, glossaries-extra-stylemods.sty, glossary-bookindex.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-childnoname.bib, example-glossaries-cite.bib, example-glossaries-images.bib, example-glossaries-long.bib, example-glossaries-multipar.bib, example-glossaries-parent.bib, example-glossaries-symbols.bib, example-glossaries-url.bib, example-glossaries-xr.bib.
%% 
%% \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}
\ProvidesPackage{glossary-bookindex}[2018/05/24 v1.32 (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{\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*{\glsxtrbookindexformatheader}[1]{%
  \par{\centering\glstreegroupheaderfmt{#1}\par}%
}
\ifdef\pdfbookmark
{%
  \newcommand*{\glsxtrbookindexbookmark}[2]{%
    \ifdefstring{\@@glossarysec}{chapter}%
    {\pdfbookmark[1]{#1}{#2}}%
    {\pdfbookmark[2]{#1}{#2}}%
  }
}
{%
  \newcommand*{\glsxtrbookindexbookmark}[2]{}
}
\newcommand*{\glsxtrbookindexcolspread}{}
\newcommand*{\glsxtrbookindexmulticolsenv}{multicols}
\newglossarystyle{bookindex}{%
  \setglossarystyle{index}%
  \renewenvironment{theglossary}%
  {%
    \ifdefempty\glsxtrbookindexcolspread
    {%
      \expandafter\begin\expandafter{\glsxtrbookindexmulticolsenv}%
        {\glsxtrbookindexcols}%
    }%
    {%
      \expandafter\begin\expandafter{\glsxtrbookindexmulticolsenv}%
        {\glsxtrbookindexcols}[\glsxtrbookindexcolspread]%
    }%
    \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
     \expandafter\end\expandafter{\glsxtrbookindexmulticolsenv}%
  }%
  \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
    \edef\@glsxtr@bookindex@between{%
       \noexpand\glsxtrbookindexbetween{##1}%
    }%
    \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}##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}##3%
  }%
  \renewcommand*{\glsgroupskip}{}%
  \renewcommand*{\glsgroupheading}[1]{%
    \@glsxtr@bookindex@subsubatendgroup
    \@glsxtr@bookindex@subatendgroup
    \@glsxtr@bookindex@atendgroup
    \@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}{\thisgrptitle}%
    \glsxtrbookindexbookmark{\thisgrptitle}{index.##1}%
    \glsxtrbookindexformatheader{\thisgrptitle}%
    \nopagebreak\indexspace\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'.
