bib2gls application FAQ
Yes, it is. You can use the flatten-lonely option. For example, suppose you have a file called entries.bib that contains:
@index{animal}
@index{mineral}
@index{vegetable}
@entry{quartz,
name={quartz},
description={hard mineral consisting of silica},
parent={mineral}
}
@entry{diamond,
name={diamond},
description={a metastable allotrope of carbon},
parent={mineral}
}
@entry{abelsonite,
name={abelsonite},
description={a nickel porphyrin mineral},
parent={mineral}
}
@entry{cabbage,
name={cabbage},
description={vegetable with thick green or purple leaves},
parent={vegetable}
}
@entry{cauliflower,
name={cauliflower},
description={type of cabbage with edible white flower head},
parent={vegetable}
}
@entry{duck,
name={duck},
description={a waterbird with webbed feet},
parent={animal}
}
@entry{parrot,
name={parrot},
description={mainly tropical bird with bright plumage},
parent={animal}
}
The document below only references some of these entries and as a result there are some sub-entries with no siblings:
\documentclass{report}
\usepackage[record,stylemods,style=tree]{glossaries-extra}
\GlsXtrLoadResources[src={entries}]
\begin{document}
Test: \gls{abelsonite}, \gls{cabbage}, \gls{cauliflower}, \gls{animal}
and \gls{duck}.
\printunsrtglossary
\end{document}
The glossary has the following structure:
- animal 1
- duck a waterbird with webbed feet 1
- mineral
- abelsonite a nickel porphyrin mineral 1
- vegetable
- cabbage vegetable with thick green or purple leaves 1
- cauliflower type of cabbage with edible white flower head 1
There are two sub-entries with no siblings: “duck” (where its parent has also been indexed) and “abelsonite” (where its parent hasn’t been indexed). If the resource option flatten-lonely=presort is used, the “abelsonite” entry will be moved up a hierarchical level and its parent will be removed. The “duck” entry won’t be modified as its parent has been indexed. The result now has the hierarchy:
- abelsonite a nickel porphyrin mineral 1
- animal 1
- duck a waterbird with webbed feet 1
- vegetable
- cabbage vegetable with thick green or purple leaves 1
- cauliflower type of cabbage with edible white flower head 1
Compare this with flatten-lonely=postsort where the resulting hierarchy is:
- animal 1
- duck a waterbird with webbed feet 1
- mineral, abelsonite a nickel porphyrin mineral 1
- vegetable
- cabbage vegetable with thick green or purple leaves 1
- cauliflower type of cabbage with edible white flower head 1
If you want the “duck” entry to also be adjusted, then it’s necessary to change the flatten-lonely-rule option but note that the parent entry can’t be removed as it’s been indexed in the document.
For example, with:
\GlsXtrLoadResources[src={entries},
flatten-lonely=presort,
flatten-lonely-rule={discard unrecorded}
]
Then the resulting hierarchy is:
- abelsonite a nickel porphyrin mineral 1
- animal 1
- duck a waterbird with webbed feet 1
- vegetable
- cabbage vegetable with thick green or purple leaves 1
- cauliflower type of cabbage with edible white flower head 1
2020-06-29 12:27:31
Permalink: https://www.dickimaw-books.com/faq.php?id=240
Alternative link: https://www.dickimaw-books.com/faq.php?itemlabel=bib2gls-lonely
Category: bib2gls application
Topic:
Automated Adjustments
