0

I have a document that consists of sub-documents which are organized as chapters. These chapters have no numbers because the chapter titles are the titles of the sub-documents. Each chapter has its own pagenumbering, toc, etc. I want to include one glossary per chapter that contains all acronyms used in this chapter and only those used.

Using the method that I found here, this should be possible. Unfortunately this seems to work only for numbered chapters as this number (\thechapter) is used in the style definition (as far as I understand the code). Is there a way to use a hidden chapter number or ID for referencing the glossary entries?

Many thanks in advance

Chris

\documentclass[a4paper, oneside, numbers=noenddot]{scrbook}

\usepackage{datatool-base} \usepackage[counter=chapter,xindy,section=section]{glossaries}

\GlsSetXdyMinRangeLength{0}

\makeglossaries \newglossaryentry{E}{name={\ensuremath{E}},description={energy}} \newglossaryentry{m}{name={\ensuremath{m}},description={mass}} \newglossaryentry{c}{name={\ensuremath{c}},description={speed of light}} \newglossaryentry{v}{name={\ensuremath{v}},description=velocity} \newglossarystyle{mystyle}% {% \setglossarystyle{list}% \renewcommand{\glossaryentrynumbers}[1]{\striprelax##1\endstriprelax}% \renewcommand{\glsXchapterXglsnumberformat}[2]{##2}% \renewcommand{\delimR}{,}% \renewcommand{\glossentry}[2]{% \edef\doifinlocation{\noexpand\ifinlocation{\thechapter}{##2}}% \doifinlocation {% \item \glossentryname{##1} \glossentrydesc{##1}% }% }% } \newcommand{\ifinlocation}[3]{% \DTLifinlist{#1}{#2}{#3}{}% } \def\striprelax\relax#1\endstriprelax{#1} \setglossarystyle{mystyle}

\begin{document} \chapter*{Sample Chapter} \printglossary \begin{equation} \gls{E} = \gls{m}\cdot \gls{c}^2 \end{equation}

\glsresetall 
\chapter*{Another Chapter}
\printglossary
\begin{equation}
    \gls{E} = \frac{\gls{m}\gls{v}^2}{2}
\end{equation}

\end{document}

ChrisW
  • 1
  • 1
    I tried the code fo https://tex.stackexchange.com/a/325566/161015 using \chapter*{Sample Chapter} and \chapter*{Another Chapter} and got the the glossary by chapter. Perhaps you should include a MWE that reproduce your result. – Simon Dispa Jun 02 '21 at 16:49
  • I added the sample code above. When using \chapter I get the correct result. \chapter* (with asterisk) gives one glossary per chapter, too. But in both glossaries are ALL symbols listed even if they are not referred in the corresponding chapter. – ChrisW Jun 06 '21 at 12:56

0 Answers0