LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and Acronymsglossaries | format for first long form of glossary entry Topic is solved

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
Aquaman
Posts: 2
Joined: Wed Aug 28, 2013 3:57 am

glossaries | format for first long form of glossary entry

Postby Aquaman » Wed Aug 28, 2013 4:27 am

Dear Helpers,

I would like to chance how the entry will be displayed on first use in the text. I can use \defglsdisplayfirst{\emph{#1#4}} to change the format. But I don't want to emphasise the whole entry, I would like just to emphasize the long from and the short form shout appear not emphasized in brackets. Like this:
Long term (short term).

The code so far:
  1. \documentclass{article}
  2. \usepackage{glossaries}
  3.  
  4. \newacronym{sample}{short}{long}
  5. \makeglossaries
  6.  
  7. \defglsdisplayfirst{\emph{#1#4}}
  8.  
  9. \begin{document}
  10. First: \gls{sample}. Next: \gls{sample}.
  11. \printglossaries
  12. \end{document}


I also tried something like this, with no success. In this case the short form is mssing at all:
  1. \documentclass{article}
  2. \usepackage[smaller]{glossaries}
  3.  
  4. \newacronym{sample}{short}{long}
  5. \makeglossaries
  6.  
  7. \defglsdisplayfirst{\emph{#1#4}}
  8. \renewcommand*{\firstacronymfont}[1]{\normalfont{#1}}
  9. \renewcommand*{\acronymfont}[1]{#1}
  10.  
  11. \begin{document}
  12. First: \gls{sample}. Next: \gls{sample}.
  13. \printglossaries
  14. \end{document}


Does anybody has an idea? Thank you very much and with best regards,
Aquaman

PS: Sorry for my bad english, it is not my native language.
Last edited by Aquaman on Mon Sep 02, 2013 8:01 pm, edited 1 time in total.

Tags:

User avatar
nlct
Posts: 266
Joined: Thu Nov 06, 2008 11:15 am
Contact:

Postby nlct » Sat Aug 31, 2013 3:46 pm

It's easiest to define a custom style to do this:

  1. \documentclass{article}
  2.  
  3. \usepackage{glossaries}
  4.  
  5. \makeglossaries
  6.  
  7. \renewcommand*{\CustomAcronymFields}{%
  8. name={\the\glsshorttok},% name is abbreviated form
  9. description={\the\glslongtok},% description is long form
  10. first={\noexpand\emph{\the\glslongtok}\space(\the\glsshorttok)},%
  11. firstplural={\noexpand\emph{\the\glslongtok\noexpand\acrpluralsuffix}\space(\the\glsshorttok)},%
  12. text={\the\glsshorttok},%
  13. plural={\the\glsshorttok\noexpand\acrpluralsuffix}%
  14. }
  15.  
  16. \SetCustomStyle
  17.  
  18. \newacronym{sample}{short}{long}
  19.  
  20. \begin{document}
  21.  
  22. First: \gls{sample}. Next: \gls{sample}.
  23.  
  24. \printglossaries
  25.  
  26. \end{document}


Regards
Nicola Talbot

Aquaman
Posts: 2
Joined: Wed Aug 28, 2013 3:57 am

Postby Aquaman » Mon Sep 02, 2013 8:00 pm

Dear Nicola,

thank you very much for your answer and your help. It works perfektly.

Best regards,
Aquaman


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 1 guest