MakeIndex, Nomenclature, Glossaries and Acronymsglossaries | format for first long form of glossary entry

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

glossaries | format for first long form of glossary entry

Post by Aquaman »

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:

Code: Select all

\documentclass{article}
\usepackage{glossaries}

\newacronym{sample}{short}{long}
\makeglossaries

\defglsdisplayfirst{\emph{#1#4}}

\begin{document}
  First: \gls{sample}. Next: \gls{sample}.
  \printglossaries
\end{document}
I also tried something like this, with no success. In this case the short form is mssing at all:

Code: Select all

\documentclass{article}
\usepackage[smaller]{glossaries}

\newacronym{sample}{short}{long}
\makeglossaries

\defglsdisplayfirst{\emph{#1#4}}
\renewcommand*{\firstacronymfont}[1]{\normalfont{#1}}
\renewcommand*{\acronymfont}[1]{#1}

\begin{document}
  First: \gls{sample}. Next: \gls{sample}.
  \printglossaries
\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.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

glossaries | format for first long form of glossary entry

Post by nlct »

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

Code: Select all

\documentclass{article}

\usepackage{glossaries}

\makeglossaries

\renewcommand*{\CustomAcronymFields}{%
  name={\the\glsshorttok},% name is abbreviated form
  description={\the\glslongtok},% description is long form
  first={\noexpand\emph{\the\glslongtok}\space(\the\glsshorttok)},%
  firstplural={\noexpand\emph{\the\glslongtok\noexpand\acrpluralsuffix}\space(\the\glsshorttok)},%
  text={\the\glsshorttok},%
  plural={\the\glsshorttok\noexpand\acrpluralsuffix}%
}

\SetCustomStyle

\newacronym{sample}{short}{long}

\begin{document}

First: \gls{sample}. Next: \gls{sample}.

\printglossaries

\end{document}
Regards
Nicola Talbot
Aquaman
Posts: 2
Joined: Wed Aug 28, 2013 3:57 am

Re: glossaries | format for first long form of glossary entr

Post by Aquaman »

Dear Nicola,

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

Best regards,
Aquaman
Post Reply