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

Bug Tracker

ID 175🔗
Date: 2021-06-22 18:48:44
Status Closed (Fixed)
Category glossaries-extra
Version 1.45
Summary Spurious space with hyperoutside being false

Sign in to subscribe to notifications about this report.

Description

Let's try to typeset the domain of a function like this:
\glssetcategoryattribute{unaryop}{hyperoutside}{false}
\glssetcategoryattribute{unaryop}{textformat}{mathop}
\newglossaryentry{dom}{…, name={\(\mathrm{dom}\)}, category=unaryop, text=\mathrm{dom}, description={…}, …}
\begin{document}
$x\in\gls{dom}f$
\end{document}
Then you get spurious thin space before “dom f”. Of course, you can counteract this by saying \! (and there are other workarounds as well), but this particular usage better be fixed in the package rather than on the user level.

The code to run is pdflatex mwe && makeindex -s mwe.ist -t mwe.nlg -o mwe.not mwe.ntn in a loop till stabilization. Alternatively, you can run latex mwe && makeindex -s mwe.ist -t mwe.nlg -o mwe.not mwe.ntn && dvips mwe till stabilization.

MWE

Download (1.06K)

\documentclass{article}
\usepackage[hidelinks]{hyperref}
\usepackage[makeindex,nomain]{glossaries-extra}
\newcommand{\goodDomain}{\mathop{\gls{good}}}
\newcommand{\anotherGoodDomain}{\mathop{\gls{anotherGood}}}
\newcommand{\badDomain}{\gls{bad}}
\newglossary[nlg]{notation}{not}{ntn}{Notation}
\makeglossaries
\glssetcategoryattribute{unaryop}{hyperoutside}{false}
\glssetcategoryattribute{unaryop}{textformat}{mathop}
\glssetcategoryattribute{anotherunaryop}{textformat}{mathrm}
\newglossaryentry{good}{type=notation, name={\(\mathrm{dom}\)}, text=\mathrm{dom}, sort={mapDomain}, description={A good domain of a function}}
\newglossaryentry{anotherGood}{type=notation, name={\(\mathrm{dom}\)}, category=anotherunaryop, text=dom, sort={mapDomain2}, description={Another good domain of a function}}
\newglossaryentry{bad}{type=notation, name={\(\mathrm{dom}\)}, category=unaryop, text=\mathrm{dom}, sort={mapDomain3}, description={A bad domain of a function}}
\begin{document}
\noindent$x\in\goodDomain f$\\$x\in\anotherGoodDomain f$\\$x\in\badDomain f$
\printglossaries
\end{document}

Evaluation

This was tricky to track down, but I finally worked out that it was due to a bug in \@glsxtrsetaliasnoindex which introduced unwanted scoping in v1.21 when \ifglshasfield (which doesn't add grouping) was replaced with the unstarred version of \glsxtrifhasfield (which does). This was causing \glsxtrsetaliasnoindex to be scoped so it no longer had any effect, but it also introduced {} which only makes a noticeable visual difference under very specific circumstances, such as the one in your MWE.

So what $x\in\gls{bad}f$ is essentially doing in your MWE is

$x\in{}\mathop{\glsxtrdohyperlink{glo:bad}{\mathrm{dom}}}f$
when hyperoutside is false and it's that {} which is causing the space. When hyperoutside is true, it's essentially doing:
$x\in{}\glsxtrdohyperlink{glo:bad}{\mathop{\mathrm{dom}}}f$
which again has the unwanted group but it now doesn't cause the spurious space.

This is now fixed in v1.46 but in the meantime the following patch should work:

\makeatletter
\renewcommand*{\@glsxtrsetaliasnoindex}{%
 \s@glsxtrifhasfield{alias}{\glslabel}%
 {%
   \let\glsxtrindexaliased\@glsxtrindexaliased
   \glsxtrsetaliasnoindex
   \let\glsxtrindexaliased\@no@glsxtrindexaliased
 }%
 {}%
}
\makeatother
(Allow a few days for the update to reach the TeX distributions.)

Comments

1 comment.

🔗Comment from anonymous
Date: 2021-09-20 16:20:08

Short testing confirms the workaround. Please proceed with v1.46.
Cheers!

Replying to Comment #68:

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.


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=175