I am trying to make glossaries per chapter for my book. This per chapter design for the glossary is tested from this answer at TEX.SX. But I am not able to print the glossary at the end of each chapter separately even the program runs but generates only the expanded version of the glossary every time.
Here is a MWE as per answer from earlier post.
\documentclass{book}% I am trying it for book
\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}
makeindexormakeglossariesduring the compile? forglossariesyour make routine should be:pdflatex->makeglossaries-> 2xpdflatex-><pdfviewer>– naphaneal Aug 11 '18 at 12:44pdflatex > Bibtex > Makeindex > MakeGlossary > pdflatex > pdfviewer. The output glossary is not printed instead where I have use d`\gls{E} its simply print E and not the glossary. – Deb bijan Aug 11 '18 at 15:05makeindexin the compile run. just usemakeglossaries. I ran your code with the routine in my last comment. it worked fine. – naphaneal Aug 11 '18 at 15:18pdfTeX warning (dest): name{glo:m} has been referenced but does not exist, replaced by a fixed oneFurther on simply running of MakeGlossary gives following messages
Command Line: makeindex.exe -s "mainbook.ist" -t "mainbook.glg" -o "mainbook.gls" "mainbook.glo"Index style file mainbook.ist not found. Usage: makeindex [-ilqrcgLT] [-s sty] [-o ind] [-t log] [-p num] [idx0 idx1 ...]– Deb bijan Aug 11 '18 at 15:55This is makeindex, version 2.15 [MiKTeX 2.9.6730 64-bit] (kpathsea + Thai support). Scanning style file ./mainbook.ist.............................done (29 attributes redefined, 0 ignored). Scanning input file mainbook.glo...done (0 entries accepted, 5 rejected). Nothing written in mainbook.gls. Transcript written in mainbook.glg.– Deb bijan Aug 12 '18 at 09:31makeglossariesshould point to:C:\MiKTeX\texmf\scripts\glossaries. (adapt to your situation.) correct, try and rerun. if that does not help. reinstall MiKTeX. I think, there went something wrong during installation. – naphaneal Aug 12 '18 at 16:58