1

I am working in a very large document and I want to create a Glossary, List of abbreviations/acronyms and an Index using the package glossaries-extra with bib2gls. For having a more practical example, lets assume I have the next .tex document:

\documentclass{article}
\usepackage{amsmath}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\usepackage{cleveref}
\usepackage[
    stylemods={all},
    record,
    index,
    abbreviations,
    nohypertypes={index}
    ]{glossaries-extra}


\begin{filecontents}{glossary.bib}
    % Encoding: UTF-8
    @entry{duck,
        name = {duck},
        description = {a waterbird with webbed feet}
    }

    @entry{parrot,
        name = {parrot},
        description = {mainly tropical bird with bright plumage}
    }

    @entry{dummy,
        name={dummy},
        description={person who is stupid}
    }

    @entry{abnormal,
        name={abnormal},
        description={not normal}
    }

    @entry{zebra,
        name={zebra},
        description={a horse with black and white stripes}
    }
    @abbreviation{sra,
        short = {SRA},
        long = {Some Random Abbreviation}
    }

    @abbreviation{ttl,
        short = {TTL},
        long = {Time To Live}
    }

    @abbreviation{html,
        short={html},
        long={hypertext markup language}
    }

    @abbreviation{xml,
        short={xml},
        long={extensible markup language}
    }

    @abbreviation{svm,
        short={SVM},
        long={support vector machine}
    }

    @index{goose,
        plural={geese}
    }

    @index{cat,
        plural={cats}
    }

    @index{carrot,
        plural={carrots}
    }

    @index{dog,
        plural={dogs}
    }

    @index{giraffe,
        plural={giraffes}
    }

    @index{rat,
        plural={rats}
    }
\end{filecontents}

\GlsXtrLoadResources[
    src={glossary},% data in glossary.bib
    sort={en-US},% sort according to 'en-US' locale
    match={entrytype={entry}},% only select@entry
    type={main}% put these entries in the 'main' glossary
]

\GlsXtrLoadResources[
    src={glossary},% data in abbreviations.bib
    sort={en-US},% sort according to 'en-US' locale
    match={entrytype={abbreviation}},% only select@abbreviation
    type={abbreviations},% put these in the 'abbreviations' glossary
    save-locations=false
]

\GlsXtrLoadResources[
src={glossary},% data in index.bib
sort={en-US},% sort according to 'en-US' locale
match={entrytype={index}},% only select@index
type={index}% put these in the 'index' glossary
]

\begin{document}

    A \gls{duck} and a \gls{parrot}. Lots of \glspl{duck}. \Gls{dummy}, \gls{abnormal} and \gls{zebra}.

    \Gls{sra}, \gls{ttl}, \gls{html}, \gls{svm} and \gls{xml}.

    \Gls{cat}, \gls{carrot}, \gls{dog}, \gls{giraffe}, \gls{rat} and \gls{goose}.

    \Gls{sra}, \gls{ttl}, \gls{html}, \gls{svm},  and \gls{xml}.

    \printunsrtglossary[style=altlistgroup]
    \printunsrtglossary[type={abbreviations}]
    \printunsrtglossary[type={index},title=Index,style=bookindex]

\end{document}

It produces the next output: enter image description here

I have some problems:

  1. In the main Glossary, although I am using the altlistgroup style, the grouping is not beeing done.
  2. In the main Glossary, also I would like to have a dot in the end of the description.
  3. For the abbreviations, I want them to be grouped (like in this document). Also, I would like that the links of abbreviations in the text not to be colored.
  4. In the index, also the grouping is falling despite I am using the bookindex style.

I have spent so many time searching for a solution but I haven't found it. I would appreciate any help.

  • Try to add "nostyles" option in glossaries-extra options. I am using ´bib2gls´ with ´gls-extra´ too in other document, where everything works like you want. So, instead for working out the full doc and finding it, I try to comment you what differences are between yours and mine (until any expert on gls-extra shows up ;) ) In ´bib2gls´ compilation, you have to specify "´group´" argument to obtain grouped glossaryies ... I bet you did not done that! ;) Instead of ´\printunsrtglossary[altilistgroup], try ´\setglossarystyle{altlistgroup}´. it might work for you ;) – Tomáš Kruliš Nov 8 '19 at 12:11
  • For not colored links, I think you have to discard link coloring altogether, so in hyperref options, omit all you have and have only one option, "hidelinks" – Tomáš Kruliš Nov 8 '19 at 12:31
  • Wow, thank you very much @TomášKruliš! I didn't know I needed to specify the group argument in the compilation of bib2gls and I was getting mad with this. I will continue researching about the link issue. – MikelBa Nov 8 '19 at 14:39
0

This almost works:

\documentclass{article}
\usepackage{amsmath}
\usepackage[hidelinks]{hyperref}
\usepackage{cleveref}
\usepackage[
    nostyles,
    stylemods={all},
    postdot,
    record,
    index,
    abbreviations,
    nohypertypes={index}
    ]{glossaries-extra}

\setglossarystyle{long-booktabs}

\begin{filecontents}{glossary.bib}
    % Encoding: UTF-8
    @entry{duck,
        name = {duck},
        description = {a waterbird with webbed feet}
    }

    @entry{parrot,
        name = {parrot},
        description = {mainly tropical bird with bright plumage}
    }

    @entry{dummy,
        name={dummy},
        description={person who is stupid}
    }

    @entry{abnormal,
        name={abnormal},
        description={not normal}
    }

    @entry{zebra,
        name={zebra},
        description={a horse with black and white stripes}
    }
    @abbreviation{sra,
        short = {SRA},
        long = {Some Random Abbreviation}
    }

    @abbreviation{ttl,
        short = {TTL},
        long = {Time To Live}
    }

    @abbreviation{html,
        short={html},
        long={hypertext markup language}
    }

    @abbreviation{xml,
        short={xml},
        long={extensible markup language}
    }

    @abbreviation{svm,
        short={SVM},
        long={support vector machine}
    }

    @index{goose,
        plural={geese}
    }

    @index{cat,
        plural={cats}
    }

    @index{carrot,
        plural={carrots}
    }

    @index{dog,
        plural={dogs}
    }

    @index{giraffe,
        plural={giraffes}
    }

    @index{rat,
        plural={rats}
    }
\end{filecontents}

\GlsXtrLoadResources[
    src={glossary},% data in glossary.bib
    sort={en-US},% sort according to 'en-US' locale
    match={entrytype={entry}},% only select@entry
    type={main}% put these entries in the 'main' glossary
]

\GlsXtrLoadResources[
    src={glossary},% data in abbreviations.bib
    sort={en-US},% sort according to 'en-US' locale
    match={entrytype={abbreviation}},% only select@abbreviation
    type={abbreviations},% put these in the 'abbreviations' glossary
    save-locations=false
]

\GlsXtrLoadResources[
src={glossary},% data in index.bib
sort={en-US},% sort according to 'en-US' locale
match={entrytype={index}},% only select@index
type={index}% put these in the 'index' glossary
]

\begin{document}

    A \gls{duck} and a \gls{parrot}. Lots of \glspl{duck}. \Gls{dummy}, \gls{abnormal} and \gls{zebra}.

    \Gls{sra}, \gls{ttl}, \gls{html}, \gls{svm} and \gls{xml}.

    \Gls{cat}, \gls{carrot}, \gls{dog}, \gls{giraffe}, \gls{rat} and \gls{goose}.

    \Gls{sra}, \gls{ttl}, \gls{html}, \gls{svm},  and \gls{xml}.

    \printunsrtglossary[style=altlistgroup]


    \printunsrtglossary[type={abbreviations}]
    \printunsrtglossary[type={index},title=Index,style=bookindex]

\end{document}

What style of abbreviations is it that you need?

  • Abbreviation style long is fine. The thing is that using the postdot option I get dots in the lis of abbreviations too, and I would like to avoid this. Also, I will like to have blue links except in Abbreviations. This is because I use very often the abbreviations and I find it very uncomfortable having a lot of blue text in some paragraphs. – MikelBa Nov 8 '19 at 14:54
  • Well, I was standing in front of similar problem, but I have chosen not to have links colored in my docs in any way. I think, that in bib2gls doc are commands like \hyperbf ; that redefine the way how page numbers are printed. Maybe from those you can derive what you need ... What you see above is what I got and can do. And I dare to say that mostly only Mrs. Talbot would know how to do what you want (if it is possible). – Tomáš Kruliš Nov 8 '19 at 15:16
  • Fine. Whatever, I appriciate very much your help. I was stuck with the problem of groups and your comments were very usefull. I think by now I will color all my links of glossaries in black with the command \renewcommand*{\glstextformat}[1]{\textcolor{black}{#1}}. However, I think that if I study more this example maybe I would figure out something. – MikelBa Nov 8 '19 at 16:40

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.