Latest news 2024-10-15: New blog post: Tales for Our Times Book Launch.

Bug Tracker RSS feed

I’m currently working on a major new version of the datatool package. This may take a while. Please be patient. (Experimental version available for testing.)

ID 175🔗
Submitted by: Peter Müller
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.)

2021-10-09: It turns out that this fix has introduced a new bug (\@glsxtrsetaliasnoindex modifies \glscurrentfieldvalue). The correct patch should be:

\renewcommand*{\@glsxtrsetaliasnoindex}{%
 \ifcsvoid{glo@\glsdetoklabel{\glslabel}@alias}%
 {}%
 {%
   \let\glsxtrindexaliased\@glsxtrindexaliased
   \glsxtrsetaliasnoindex
   \let\glsxtrindexaliased\@no@glsxtrindexaliased
 }%
}
The issue will occur if you have a reference in the form \gls{\glscurrentfieldvalue}.

Comments

5 comments.

🔗Comment from Peter Müller
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.

🔗Comment from Peter Müller
Date: 2021-10-10 09:44:47

Thanks! Do you mean, perhaps, \renewcommand instead of \newcommand? Do I still need \makeatletter and \makeatother?

Replying to Comment #69:

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.

🔗Comment from Nicola Talbot 🦜
Date: 2021-10-10 09:48:53
Repying to: Peter Müller 2021-10-10 09:44:47

Yes, sorry I copied the code from the pending new version of glossaries-extra.sty. (Now corrected.) You will need \makeatletter and \makeatother if you redefine it in the preamble (because of the presence of the internal commands \@glsxtrindexaliased and \@no@glsxtrindexaliased).

Replying to Comment #70:

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.

🔗Comment from Peter Müller
Date: 2021-10-11 13:27:53

Alright, got it, thanks! (By the way, for a reason unknown to me, the above two comments of mine are shows as “Comment from anonymous”.) Peter

Replying to Comment #71:

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.

🔗Comment from Nicola Talbot 🦜
Date: 2021-10-11 13:30:38
Repying to: Peter Müller 2021-10-11 13:27:53

The display name defaults to anonymous. You can change it in the Public Identity section of your account page.

Replying to Comment #72:

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