2

I need to define a customized glossary list based of \setglossarystyle{list} such that in front of each entry I get a counter:

  1. symbol 1 blah-blah

  2. symbol 2 blah-blah-blah

...

I assume I have to do something like this:

\newglossarystyle{symbols}{%
    \setglossarystyle{list}% % based on the list style
    \renewcommand*{\glossarypreamble}{\vspace{4ex}}%
    \renewcommand*{\glossaryheader}{}%
}

However, this style produces list of symbols and abbreviations WITHOUT counting them and also abbreviations are in bold for some reason.

I have looked at the list of styles unsuccessfully. I haven't found a command that counts the number of symbols in the list, only commands that could the number of times the entry has been used in the text. Any help is appreciated. The whole project can be found here.


Part of it is answered in the comments. The remaining question is how to make the glossary entries not in bold.

1

The entrycounter package option defines a counter called glossaryentry that's incremented and displayed at the start of each top-level term in the glossary (in styles that support it).

There are some associated commands:

  • \ifglsentrycounter ... \else ... \fi
    This conditional can be used to test if the entrycounter option was set.
  • \theglossaryentry
    Governs how the counter value is displayed (like \thepage, \thechapter etc).
  • \glsentrycounterlabel
    Used to format the counter if the setting is on. This is defined as:

    \newcommand*{\glsentrycounterlabel}{%
     \ifglsentrycounter
       \theglossaryentry.\space
     \fi
    }
    

    (Originally the conditional wasn't included in the command definition. It was added as part of a bug fix in v4.38 2018-05-10.)

  • \glsstepentry{entry-label}
    Used to both increment and label the counter. (The value can be referenced with \glsrefentry{entry-label}.)

  • \glsentryitem{entry-label}
    Used by the predefined styles to increment and display the counter. This is defined as:

    \newcommand*{\glsentryitem}[1]{%
      \ifglsentrycounter
        \glsstepentry{#1}\glsentrycounterlabel
      \else
        \glsresetsubentrycounter
      \fi
    }
    

    If you define your own custom style and you want it to support the entrycounter option you need to include \glsentryitem where you want the number to appear if the setting is on.

  • \glsresetsubentrycounter
    Resets the counter back to zero.

If the entry counters are appearing in bold then that's because the particular style in use has \glsentryitem inside a bold area. In the case of the default list style this is in the optional argument of \item. The simplest thing to do is redefine \glsentrycounterlabel to explicitly use non-bold. For example:

\documentclass{article}

\usepackage[entrycounter]{glossaries}

\makeglossaries

\loadglsentries{example-glossaries-brief}% dummy entries
\glsaddall % add all entries for testing

\renewcommand*{\glsentrycounterlabel}{%
 \ifglsentrycounter
   \textmd{\theglossaryentry.}\space
 \fi
}

\begin{document}
\printglossaries
\end{document}

image of glossary

  • Thanks a lot! It non-bolded the numbers, but the entries themselves are still bolded. How do I unbold them? It has to do with the newglossarystyle, probably, but I can't find the right command. – MsTais Mar 23 at 15:39
  • 1
    @MsTais The name is encapsulated with \glsnamefont so you can redefine that to cancel the effect of the bold created by the style (in this case it's because the list style puts the name inside the optional argument of \item). – Nicola Talbot Mar 23 at 15:46
  • Yeii! "\renewcommand*{\glsnamefont}[1]{\textmd{#1}\space}" worked for me! Thanks a lot! – MsTais Mar 23 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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