Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there a nicer alternative to glossaries package? It's a pita to use. Documentation is lacking examples, some commands don't do anything (like \glssee), it is hard to customize (why can't I make my glossary a simple section?), it is stateful - I have to call makeglossaries in a certain place, and also the syntax for defining new entries is ugly:

 \newglossaryentry{blah}{name=blah, description={blabh lbah blah}}   

It's like xml.

No offense to the creators, but I am just curious if anyone else feels this way and if there are alternatives?

share|improve this question
3  
+1 for >It's like xml. :D – Count Zero Jun 13 '12 at 21:22
4  
I hope you both mean "lovely" for "like xml" – David Carlisle Jun 13 '12 at 22:58
3  
\glssee does ‘something’ if you use it after \makeglossaries. – mhp Jun 14 '12 at 8:42
1  
You are writing a book-type document and want your glossary to appear in a simple section? Try, for example, \usepackage[section=section, numberedsection]{glossaries}. – mhp Jun 14 '12 at 8:47
4  
Undoubtedly, the glossaries package is rather complex, but, in my experience, it enables you to realize nearly anything related to glossaries, lists of acronyms, notations etc. Since the glossaries package includes tree-like styles it might also serve as a replacement for many index-related packages. Moreover, I haven’t seen any package that supports xindy in a comparable manner. – mhp Jun 14 '12 at 8:52
show 5 more comments

3 Answers

Here is an alternative to a pita.

\documentclass[11pt]{book}
\usepackage{lstdoc,lipsum}
\begin{document}
\makeatletter
\def\alist{}

\let\sort\lst@BubbleSort 
\def\addtolist#1#2{
  \lst@lAddTo\alist{#2}
}

\long\gdef\addterm#1#2{\addtolist\alist{#1,}}

\def\gentry#1#2{%
\long\expandafter\gdef\csname#1\endcsname{\textbf{#1}: #2}
\addterm{#1}{#2}
\sort\alist
}

\def\PrintGlossary{%
  \@for \i:=\alist\do{%
  \csname\i\endcsname\par}
}
%example
\gentry{electrolyte}{Substance containing free ions that make t
        he substance electrically conductive}
\gentry{battery}{\lipsum[3]}
\gentry{poles}{\lipsum[1]}
% print the glossary
\section{Glosary}
\PrintGlossary


\battery
\makeatother
\end{document}

Add ingredients to suit.

It provides one non-xml command:

  \gentry{<term>}{<description>}

...and it does not need Perl. Enjoy!

share|improve this answer
1  
Thanks, but it's missing the equivalent of the \gls command, and I would also like to do cross-referencing. E.g. car see vehicle – drozzy Jun 13 '12 at 21:45
\gentry{car}{see vehicle}. – Yiannis Lazarides Jun 13 '12 at 21:47
1  
So.. how would I use a glossary term in text? Or do you mean that this is only for defining a glossary section at the end, without page numbers of where it occurred? – drozzy Jun 15 '12 at 3:28

I changed the code above, so that you can do cross references:

\documentclass[11pt]{book} 
\usepackage{lstdoc,lipsum} 
\usepackage{hyperref}
\begin{document} 
\makeatletter 
\def\alist{} 

\let\sort\lst@BubbleSort  
\def\addtolist#1#2{ 
  \lst@lAddTo\alist{#2} 
} 

\long\gdef\addterm#1#2{\addtolist\alist{#1,}} 

\def\gentry#1#2{% 
\long\expandafter\gdef\csname.#1\endcsname{\hypertarget{target#1}{\textbf{#1}: #2}}
\expandafter\gdef\csname#1\endcsname{\hyperlink{target#1}{#1}}
\addterm{#1}{#2} 
\sort\alist 
}

\def\gentryP#1#2#3{% 
\expandafter\gdef\csname#3\endcsname{\hyperlink{target#1}{#3}}
\long\expandafter\gdef\csname.#1\endcsname{\hypertarget{target#1}{\textbf{#1}: #2}}
\expandafter\gdef\csname#1\endcsname{\hyperlink{target#1}{#1}}
\addterm{#1}{#2} 
\sort\alist 
} 

\def\PrintGlossary{%
  \section{Glosary} 
  \ 

  \@for \i:=\alist\do{% 
  \csname.\i\endcsname\par} 

  \newpage
}


%example 
\gentry{electrolyte}{Substance containing free ions that make t 
        he substance electrically conductive}
% use gentryP if the plural is irregular         
\gentryP{battery}{\lipsum[3]}{batteries} 
\gentry{poles}{\lipsum[1]}

% print the glossary 
\PrintGlossary 

\section{normal text}

\electrolyte s are used nearly everywhere.



\newpage

\battery is the singular. but sometimes you need the plural \batteries.



\makeatother 
\end{document}
share|improve this answer

The datagidx package in the datatool bundle might a good solution for you.

Datagidx is an improved version of the code discussed in this article.

Here is some package documentation.

I have not tried this myself yet, but it is the one I have settled on trying as my first approach because I don't like that the glossaries package has external dependencies.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.