%%
%% This is file `glossary-topic.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% glossaries-extra.dtx  (with options: `glossary-topic.sty,package')
%% 
%%  glossaries-extra.dtx
%%  Copyright 2020 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, glossary-longextra.sty, glossary-topic.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-symbolnames.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-topic}[2020/02/13 v1.42 (NLCT)]
\RequirePackage{multicol}
\newglossarystyle{topic}{%
  \renewenvironment{theglossary}%
  {%
    \glstopicInit
    \def\glstopic@prechildren{}%
    \def\glstopic@prevlevel{-1}%
  }%
  {\par}%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{%
    \def\glstopic@prevlevel{-1}%
    \glstopicGroupHeading{##1}%
  }%
  \renewcommand{\glossentry}[2]{%
    \hangindent0pt\relax
    \parindent\glstopicParIndent\relax
    \glstopicItem{##1}{##2}%
     \ifglshasdesc{##1}%
     {%
       \def\glstopic@prechildren{}%
     }%
     {%
       \def\glstopic@prechildren{\nopagebreak}%
     }%
  }%
  \renewcommand{\subglossentry}[3]{%
    \ifnum\glstopic@prevlevel=0\relax\glstopic@prechildren\fi
    \def\glstopic@prevlevel{##1}%
    \glstopicAssignSubIndent{##1}%
    \glstopicSubItem{##1}{##2}{##3}%
  }%
  \renewcommand*{\glsgroupskip}{}%
}
\newcommand*{\glstopicGroupHeading}[1]{}
\newcommand*{\glstopicItem}[2]{%
  \glspar\glstopicPreSkip\glspar\noindent
  \glstopicMarker{#1}%
  \glstopicTitleFont
  {%
    \glsentryitem{#1}\glstarget{#1}{\glstopicTitle{#1}}%
  }%
  \ifglshasdesc{#1}%
  {\glspar\nobreak\glstopicMidSkip\glspar\nobreak
   \@afterheading\glstopicDesc{#1}\glspar\glstopicPostSkip}%
  {\glspar\nobreak\glstopicPostSkip}%
  \glstopicLoc{#1}{#2}%
}
\newcommand*{\glstopicMarker}[1]{}
\newcommand*{\glstopicTitle}[1]{\Glossentryname{#1}%
  \ifglshassymbol{#1}{\space(\glossentrysymbol{#1})}{}%
}
\newcommand*{\glstopicTitleFont}[1]{\textbf{\large #1}}
\newcommand*{\glstopicDesc}[1]{\Glossentrydesc{#1}\glspostdescription}
\newcommand*{\glstopicLoc}[2]{}
\newlength\glstopicParIndent
\setlength\glstopicParIndent{20pt}
\newlength\glstopicSubIndent
\setlength\glstopicSubIndent{20pt}
\newcommand{\glstopicInit}{}
\newcommand*{\glstopicAssignSubIndent}[1]{%
  \par
  \parindent\dimexpr#1\glstopicSubIndent-\glstopicSubIndent\relax
  \glstopicAssignWidest{#1}%
  \hangindent\dimexpr\parindent+\glstopicwidest\relax
}
\newlength\glstopicwidest
\newcommand*{\glstopicAssignWidest}[1]{%
  \ifcsundef{@glswidestlength\romannumeral#1}%
  {%
    \ifcsdef{@glswidestname\romannumeral#1}%
    {%
      \settowidth{\glstopicwidest}{%
       \glstopicSubNameFont{\csuse{@glswidestname\romannumeral#1}}%
       \glstopicSubItemSep
      }%
    }%
    {\setlength{\glstopicwidest}{0pt}}%
    \csedef{@glswidestlength\romannumeral#1}{\the\glstopicwidest}%
  }%
  {\setlength{\glstopicwidest}{\csuse{@glswidestlength\romannumeral#1}}}%
}
\newcommand*{\glstopicPreSkip}{\medskip}
\newcommand*{\glstopicMidSkip}{\smallskip}
\newcommand*{\glstopicPostSkip}{\smallskip}
\newcommand*{\glstopicSubItem}[3]{%
  \glstopicSubItemBox{#1}{\glstopicSubNameFont{\glsentryitem{#2}%
    \glstarget{#2}{\glossentryname{#2}}}%
    \glstopicSubItemSep
  }%
  \ifglshassymbol{#2}{(\glossentrysymbol{#2})\space}{}%
  \ifglshasdesc{#2}%
   {\glossentrydesc{#2}\glspostdescription\glstopicSubPreLocSep}{}%
  \glstopicSubLoc{#2}{#3}%
}
\newcommand*{\glstopicSubItemSep}{\quad}
\newcommand*{\glstopicSubItemBox}[2]{%
  \ifdim\glstopicwidest>0pt\relax\makebox[\glstopicwidest][l]{#2}\else#2\fi
}
\newcommand*{\glstopicSubNameFont}[1]{\textbf{#1}}
\newcommand*{\glstopicSubPreLocSep}{\space}
\newcommand*{\glstopicSubLoc}[2]{#2}
\newcommand*{\glstopicCols}{2}
\newcommand*{\glstopicColsEnv}{multicols}
\newglossarystyle{topicmcols}{%
  \renewenvironment{theglossary}%
  {%
    \glstopicInit
    \def\glstopic@prechildren{}%
    \def\glstopic@postchildren{}%
    \def\glstopic@prevlevel{-1}%
  }%
  {%
    \ifnum\glstopic@prevlevel>0\relax\glstopic@postchildren\fi
    \par
  }%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{%
    \ifnum\glstopic@prevlevel>0\relax\glstopic@postchildren\fi
    \def\glstopic@prevlevel{-1}%
    \glstopicGroupHeading{##1}%
  }%
  \renewcommand{\glossentry}[2]{%
    \ifnum\glstopic@prevlevel>0\relax\glstopic@postchildren\fi
    \def\glstopic@prevlevel{0}%
    \hangindent0pt\relax
    \parindent\glstopicParIndent\relax
    \glstopicItem{##1}{##2}%
    \ifnum\glstopicCols>1\relax
      \ifglshasdesc{##1}%
      {%
        \edef\glstopic@prechildren{%
          \noexpand\begin{\glstopicColsEnv}{\glstopicCols}}%
      }%
      {%
        \edef\glstopic@prechildren{%
          \noexpand\nopagebreak
          \noexpand\begin{\glstopicColsEnv}{\glstopicCols}}%
      }%
      \edef\glstopic@postchildren{\noexpand\end{\glstopicColsEnv}}%
    \fi
  }%
  \renewcommand{\subglossentry}[3]{%
    \ifnum\glstopic@prevlevel=0\relax\glstopic@prechildren\fi
    \def\glstopic@prevlevel{##1}%
    \glstopicAssignSubIndent{##1}%
    \glstopicSubItem{##1}{##2}{##3}%
  }%
  \renewcommand*{\glsgroupskip}{}%
}
\endinput
%%
%% End of file `glossary-topic.sty'.
