LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and Acronyms ⇒ Trouble changing glossaries style

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
LeonardLopes
Posts: 11
Joined: Mon Nov 16, 2015 7:27 pm

Trouble changing glossaries style

I am having trouble removing an extra period from the altlist glossary style in the glossaries package. Basically, the glossaries package places a period at the end of the description. This is problematic if the description contains a reference (which has to go after the period). Here is a MWE:

1. \documentclass{report}
2.
3. \usepackage[nonumberlist,description]{glossaries}
4.
5. \newglossaryentry{gls:Acoustic}
6. {
7. name=acoustic,
8. description=
9. {Associated with sound, or more generally with mechanical wave propagation in a
10. medium.\cite{Morfey2000}},
11. }
12.
13. \setglossarystyle{altlist}
14.
15. \makeglossaries
16.
17. \begin{document}
18.
20.
21. \printglossaries
22.
23. \bibliographystyle{abbrv}
24. \bibliography{references}
25.
26. \end{document}

and the reference.bib file
1. @book{Morfey2000,
2. author={C. L. Morfey},
3. title={Dictionary of Acoustics},
4. year=2000,
7. }

After running pdflatex, bibtex, makeglossaries,pdflatex,pdflatex, you get the attached, MWE.pdf. Notice the double period at the end of the glossary description. I have skimmed the glossaries documentation where they have an example of redefining the list glossary style (http://mirrors.rit.edu/CTAN/macros/latex/contrib/glossaries/glossaries-user.pdf), but to be honest this might as well be written in Chinese (which I don't understand). It seems that it would be trivial to find that dot and delete it, any help would be greatly appreciated.
Attachments
MWE.pdf
Minimum working example of extra period in altlist glossary style.

Tags:

Johannes_B
Site Moderator
Posts: 4006
Joined: Thu Nov 01, 2012 4:08 pm
Once you know how LaTeX works, solving this isue is a matter of three minutes. Locate the glossaries package code, find the style file that contains the style, take a look at the specific style and notice: There is a macro \glspostdescription. Renewing this to be empty solves your issue. I haven't checked, though, if there might be other things that now work unexpected.

1. \documentclass{report}
2.
3. \usepackage[nonumberlist,description]{glossaries}
4.
5. \newglossaryentry{gls:Acoustic}
6. {
7. name=acoustic,
8. description=
9. {Associated with sound, or more generally with mechanical wave propagation in a
10. medium.~\cite{doody}
11. },
12. }
13.
14. \setglossarystyle{altlist}
15. \renewcommand{\glspostdescription}{}
16.
17. \makeglossaries
18.
19. \begin{document}
21.
22. \printglossaries
23.
24. \bibliographystyle{abbrv}
25. \bibliography{biblatex-examples}
26.
27. \end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

LeonardLopes
Posts: 11
Joined: Mon Nov 16, 2015 7:27 pm
Thank you. I was reluctant to modify the glossary distribution, but in my document, I placed:

1. \setglossarystyle{altlist}
2.
3. \renewcommand*{\glspostdescription}{%
4. \spacefactor\sfcode\.
5. }

This is taken from the following in glossaries.sty:

1. \newcommand*{\glspostdescription}{%
2. \ifglsnopostdot\else.\spacefactor\sfcode\. \fi
3. }

Now, the only problem I have is the acronyms are in the abbreviated form in the glossaries....

LeonardLopes
Posts: 11
Joined: Mon Nov 16, 2015 7:27 pm
I assume that I could set \glsnopostdot, but I couldn't figure out how to do that.

Johannes_B
Site Moderator
Posts: 4006
Joined: Thu Nov 01, 2012 4:08 pm
Don't fiddle with space factors.

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

LeonardLopes
Posts: 11
Joined: Mon Nov 16, 2015 7:27 pm
That was it! Thanks a lot, you've ended about a day of banging my head on a wall... now for the next wall...

nlct
Posts: 275
Joined: Thu Nov 06, 2008 11:15 am
The simplest method, which no one has mentioned so far, is to use the nopostdot package option:

1. \usepackage[nopostdot]{glossaries}

This setting can also be used on a per-glossary basis:

1. \printglossary[nopostdot]