MakeIndex, Nomenclature, Glossaries and AcronymsGlossaries,acronym, symbols, etc. per chapter with style super so that description part aligned vertically

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
Post Reply
bijandeb
Posts: 1
Joined: Mon Aug 27, 2018 5:02 am

Glossaries,acronym, symbols, etc. per chapter with style super so that description part aligned vertically

Post by bijandeb »

I am using the sample code provided by TEX.SX provided by Talbothttps://tex.stackexchange.com/questions ... dex/287128 and also here https://tex.stackexchange.com/questions ... 800_325566 . But here the glossaries are not arranged in an aligned mode which looks very bad in formatting. It would be very good if both the name and description etc are aligned vertically so that there is clear readability of each of the glossary terms, symbols, acronym, notation or whatever be the custom glossaries used per chapter. The super style is good looking, but not able to do using the provided idea for per chapter in mentioned link.

The MWE may same as provided in this page or I have copied.
There should be two options, 1. Each unique glossaries per chapter is printed which is not used earlier chapter
2. Each chapter glossaries are printed irrespective of used earlier or not. In this case, there may be some repetition of glossaries even if it used in previous chapters.

Code: Select all

\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}% % I want to use style=super for per chapter glossary with aligned description
  \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}
\end{document}
I want the output of this short
[img]
https://i.stack.imgur.com/nb9hI.png
[/img]
Attachments
nb9hI.png
nb9hI.png (16.27 KiB) Viewed 7069 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
Post Reply