Latest news 2021-09-06: new blog post "Legacy Documents and TeX Live Docker Images".

Bug Tracker

ID 176🔗
Date: 2021-09-14 08:57:49
Status Closed (Fixed)
Category glossaries-extra
Version 1.45
Summary Last displayed topic subitem has invalid indentation

Sign in to subscribe to notifications about this report.

Description

Greetings,

first of, your package is really great. I use it to write my PhD thesis. I was following your example from page Logical Glossary Divisions (type vs group vs parent) for single hierarchical glossary where the top-level entries represent topics.

Using this style with

set-widest
option using
\GlsXtrLoadResources
, I've found an invalid indentation for the last displayed subitem if the description is a couple of rows long.

I found a solution by changing the style as follows:

    \renewcommand*{\glstopicAssignSubIndent}[1]{%
        \parindent\dimexpr##1\glstopicSubIndent-\glstopicSubIndent\relax
        \glstopicAssignWidest{##1}%
        \hangindent\dimexpr\parindent+\glstopicwidest\relax
    }%
    \renewcommand*{\subglossentry}[3]{%
        \ifnum\glstopic@prevlevel=0\relax\glstopic@prechildren\fi
        \def\glstopic@prevlevel{##1}%
        \glstopicAssignSubIndent{##1}%
        \glstopicSubItem{##1}{##2}{##3}%
        \par%
    }%

MWE

Download (2.92K)

\documentclass[a4paper,twoside,openright,12pt, draft]{book}
\usepackage{filecontents}
\usepackage[
    %automake=immediate,
    %automake,
    nomain, 
    nosuper, abbreviations, symbols, toc=false, 
    %record=alsoindex% create group field and other stuff
    record,
    stylemods={list,tree,topic,longextra,longbooktabs}
]{glossaries-extra} % for nomenclature

% Correct topic style
\makeatletter
\newglossarystyle{correctedtopic}{%
    \setglossarystyle{topic}% base this style on the topic style
    \renewcommand*{\glstopicAssignSubIndent}[1]{%
        \parindent\dimexpr##1\glstopicSubIndent-\glstopicSubIndent\relax
        \glstopicAssignWidest{##1}%
        \hangindent\dimexpr\parindent+\glstopicwidest\relax
    }%
    \renewcommand*{\subglossentry}[3]{%
        \ifnum\glstopic@prevlevel=0\relax\glstopic@prechildren\fi
        \def\glstopic@prevlevel{##1}%
        \glstopicAssignSubIndent{##1}%
        \glstopicSubItem{##1}{##2}{##3}%
        \par%
    }%

}
\makeatother

\begin{filecontents}{terms.bib}
    % Encoding: UTF-8
    @indexplural{feat,
    text  = {Feature vector},
    topic = {symbol}
    }
    @indexplural{imaging,
    text  = {Image},
    topic = {symbol}
    }
    @symbol{featvec,
    name        = {\ensuremath{x_j}},
    description = {a feature vector of  identifier ID representing an image from a subset $D'$},
    identifier  = {feat}
    }

    @symbol{featvecset,
    name        = {\ensuremath{X}},
    description = {a set of feature vectors from a identifiering task},
    identifier  = {feat}
    }

    @symbol{labelfeatvec,
    name        = {\ensuremath{y_j}},
    description = {a feature vector of label features representing an image from a subset $D'$},
    identifier  = {feat}
    }

    @symbol{labelfeatvecset,
    name        = {\ensuremath{Y}},
    description = {a set of feature vectors from a labeling task},
    identifier  = {feat}
    }

    @symbol{nuhuman,
    name        = {\ensuremath{\nu_h}},
    description = {an attribute of a feature vector representing ID from each human identification task},
    identifier  = {feat}
    }

    @symbol{img,
    name        = {\ensuremath{n}},
    description = {an image},
    identifier  = {imaging}
    }

    @symbol{imgsize,
    name        = {\ensuremath{N}},
    description = {image size},
    identifier  = {imaging}
    }

    @symbol{imgset,
    name        = {\ensuremath{{H}}},
    description = {a set of images},
    identifier  = {imaging}
    }

    @symbol{imgsubset,
    name        = {\ensuremath{I'}},
    description = {a subset of images},
    identifier  = {imaging}
    }
\end{filecontents}

\GlsXtrLoadResources[
  src={terms.bib},
  field-aliases={identifier=parent},
  selection={all},
  save-locations={true},
  type={symbols},
  set-widest
]

\begin{document}
\setglossarystyle{topic}
\printunsrtglossary[type=symbols]
\end{document}

Evaluation

Thank you. Appending \par to \subglossentry does indeed fix the problem. Unfortunately removing \par from the start of \glstopicAssignSubIndent upsets the topicmcols style. Leaving \glstopicAssignSubIndent unchanged but adding \par to \subglossentry seems to work for both styles.

Now fixed in v1.46 (allow a few days for the update to reach TeX distributions).

Comments

0 comments.


Add Comment

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:

You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

You can use the Preview button to review your message formatting before submitting.

Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=176