LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and AcronymsAcronym section showing abbreviation

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

Acronym section showing abbreviation

Postby LeonardLopes » Wed Nov 18, 2015 5:29 pm

I have a simple MWE where I have an acronym that I reference. The first time it puts out the full name with the acronym and every subsequent time it puts out just the acronym. Well that's all find and dandy, but when it puts out the acronym list, the title of the acronym is the abbreviation. I want the full name with the abbreviation to be there (i.e. "minimal working example (MWE)" instead of just "MWE"). It seems that the name of the glossary entry in the acronym section is tied to \glsentryname (I think).

  1. \documentclass{report}
  2. \usepackage[acronym,nonumberlist,description]{glossaries}
  3. \newglossaryentry{mwe}
  4. {
  5. type=\acronymtype,
  6. name={MWE},
  7. description={A short example to illustrate a problem},
  8. long={minimal working example},
  9. first={minimal working example (\glsentryname{mwe})}
  10. }
  11. \setglossarystyle{altlist}
  12. \makeglossaries
  13. \begin{document}
  14. \gls{mwe}
  15. \gls{mwe}
  16. \glsaddall
  17. \printglossaries
  18. \end{document}


I've tried fiddling with the name of the acronym, short, long, etc. but can't seem to find the combination that results in my desired behavior.
Attachments
MWE.pdf
Minimal working example
(31.89 KiB) Downloaded 103 times

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 3515
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed Nov 18, 2015 5:39 pm

The list is for looking up the acronyms, consider CTAN which you used a few time in your document. The reader who wants to know the long form has to read through all the entries with C till he gets to Comprehensive TeX Archive Network. This might be quite some reading and the purpose of a fast lookup is gone.
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

Postby LeonardLopes » Wed Nov 18, 2015 5:55 pm

I understand what you are saying and it is probably a good point. I have checked the formatting requirements for the document I am generating and of course they don't have any.

LeonardLopes
Posts: 11
Joined: Mon Nov 16, 2015 7:27 pm

Postby LeonardLopes » Wed Nov 18, 2015 6:14 pm

Is there a way to have the acronym first, then the length?

CTAN: Comprehensive TeX Archive Network
DESCRIPTION

LeonardLopes
Posts: 11
Joined: Mon Nov 16, 2015 7:27 pm

Postby LeonardLopes » Wed Nov 18, 2015 7:18 pm

I have decided to go down this route:

http://tex.stackexchange.com/questions/8946/how-to-combine-acronym-and-glossary

Thanks for your help!

User avatar
Johannes_B
Site Moderator
Posts: 3515
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed Nov 18, 2015 7:27 pm

Define your own style and use it.
  1. \documentclass{report}
  2. \usepackage[acronym,nonumberlist,description]{glossaries}
  3. \newglossaryentry{gls:Acoustic}
  4. {
  5. name=acoustic,
  6. description=
  7. {Associated with sound, or more generally with mechanical wave propagation in a
  8. medium.
  9. },
  10. }
  11. \newglossaryentry{ctan}
  12. {
  13. type=\acronymtype,
  14. name={CTAN},
  15. description={this is a long description},
  16. % long={},%no long form
  17. first={just for testing (\glsentryname{ctan})}
  18. }
  19. \newglossaryentry{mwe}
  20. {
  21. type=\acronymtype,
  22. name={MWE},
  23. description={A short example to illustrate a problem},
  24. long={minimal working example},
  25. first={minimal working example (\glsentryname{mwe})}
  26. }
  27.  
  28. \setglossarystyle{altlist}
  29.  
  30. \makeatletter
  31. \newglossarystyle{leonard}{%
  32. \setglossarystyle{list}%
  33. \renewcommand*{\glossentry}[2]{%
  34. \item[\glsentryitem{##1}%
  35. \glstarget{##1}{\glossentryname{##1}}]%
  36. \glsentrylong{##1}
  37. \mbox{}\par\nobreak\@afterheading
  38. \glossentrydesc{##1}\glspostdescription\space ##2}%
  39. \renewcommand{\subglossentry}[3]{%
  40. \par
  41. \glssubentryitem{##2}%
  42. \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space ##3}%
  43. }
  44. \makeatother
  45. \makeglossaries
  46. \begin{document}
  47. \gls{mwe} and later just
  48. \gls{mwe}
  49.  
  50. \gls{ctan} and later just
  51. \gls{ctan}
  52. \glsaddall
  53. \printacronyms[style=leonard]
  54. \printglossaries
  55. \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.


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 1 guest