Bug Tracker

ID 194🔗
Submitted by: Peter Müller
Date: 2021-12-30 11:08:57
Last update: 2022-06-24 19:57:22
Status Open
Bumped ×1
Category glossaries-extra
Version 1.48
Summary setting mathrel category gives ordinary spacing instead of mathrel spacing
Cross Ref 189

Sign in to subscribe to notifications about this report.

Description

Continuing bug report 189, feeding
\documentclass{article}
\pagestyle{empty}
\usepackage{relsize}
\usepackage{amssymb}
\usepackage[unicode,hidelinks]{hyperref}
\usepackage[makeindex,nomain]{glossaries-extra}
\newglossary[nlg]{notation}{not}{ntn}{Symbols}
\makeglossaries
\newcommand{\booleanSetSymbol}{\mathbb{B}}%%% for pdflatex
% \newcommand{\booleanSetSymbol}{𝔹}%%% for lualatex
\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix}{m}{n}
\DeclareSymbolFont{stixsymbols2}{LS1}{stixfrak}{m}{n}%%% for \typecolon (we call is \hasSortSymbol) ⦂ (U+2982)
\newcommand{\hasSortSymbol}{{\fontencoding{LS1}\fontfamily{stixfrak}\selectfont\smaller\char"25}}%%% for pdflatex
% \newcommand{\hasSortSymbol}{⦂}%%% for lualatex
%\usepackage{unicode-math}%%% for lualatex
\glssetcategoryattribute{mathrelation}{hyperoutside}{false}
\glssetcategoryattribute{mathrelation}{textformat}{mathrel}
\newglossaryentry{not:booleanValues}{type=notation, name=\(\booleanSetSymbol\), text=\booleanSetSymbol, description={The set of Boolean values.}}
\newglossaryentry{not:function}{type=notation, name={\(\_\mathord{\to}\_\)}, text={\_\to\_}, sort={function}, description={The notation \(X{\to}Y\) means the set of all functions with domain \(X\) and codomain \(Y\). Following Bourbaki, we see a function as a triple (function graph, domain, codomain); a function \(f\penalty1\in\penalty1 X{\to}Y\), traditionally written as \(f\colon\penalty1 X\penalty2\to\penalty2 Y\), is thus \(\bigl(\mskip-1mu plus.5mu minus.5mu\{(x,f\mskip-.4mu plus.2mu minus.2mu (x\mskip-.3mu plus.15mu minus.15mu)\mskip-.5mu plus.25mu minus.25mu)\penalty2\mid\penalty1 x\mskip-3mu plus1mu minus1mu\in\mskip-3mu plus1mu minus1mu X \penalty3\land\penalty3 y\mskip-3mu plus1mu minus1mu\in\mskip-3mu plus1mu minus1mu Y\},\penalty1 X,\penalty1 Y\mskip-.3mu plus.15mu minus.15mu\bigr)\).}, user1={function}, user2={functions}, user3={map}, user4={maps}, user5={\colon}, user6={\to}}
\newglossaryentry{not:hasSort}{type=notation, name={\hasSortSymbol}, category=mathrelation, text={\text{\hasSortSymbol}}, sort={:}, description={Typing relation: \(x\mathrel{\text{\hasSortSymbol}} S\) means that the variable \(x\) has sort \(S\).}}
\begin{document}%
\newlength{\myLen}\setlength{\myLen}{32em}%
\noindent Line 1. With gls:\\
\hspace*{\myLen}\(f\gls{not:hasSort}\Sigma\mathrel{\glsuservi{not:function}}\gls{not:booleanValues}\)\\
\noindent Line 4. With gls and wrgloss=after:\\
\hspace*{\myLen}\(f\gls{not:hasSort}\Sigma\mathrel{\glsuservi{not:function}}\gls[wrgloss=after]{not:booleanValues}\)\\
\noindent Line 7.
\renewcommand*{\glslinkwrcontent}[1]{#1}%%% a quick hack according to the text concerning v1.48 in http://mirrors.ctan.org/macros/latex/contrib/glossaries-extra/CHANGES .  Without this hack, as above, the distances around \gls{not:hasSort} are improper: it should be spaced as mathrel, but it isn't.  With this hack, as below, there is a spurious space after an automatic line break.
With gls:\\
\hspace*{\myLen}\(f\gls{not:hasSort}\Sigma\mathrel{\glsuservi{not:function}}\gls{not:booleanValues}\)\\
\noindent Line 10. With gls and wrgloss=after:\\
\hspace*{\myLen}\(f\gls{not:hasSort}\Sigma\mathrel{\glsuservi{not:function}}\gls[wrgloss=after]{not:booleanValues}\)\\
\noindent Line 13.
\printglossaries
\end{document}
to pdflatex mwe && makeglossaries mwe results in [Link]. As you see, depending on whether you set \glslinkwrcontent or not, you get either a spurious space after an automatic line break or ordinary spacing around a mathrelation. I expect that \gls{not:hasSort} is typeset with mathrel spacing AND there is no spurious space after an automatic line break.

MWE

Download (3.18K)

\documentclass{article}
\pagestyle{empty}
\usepackage{relsize}
\usepackage{amssymb}
\usepackage[unicode,hidelinks]{hyperref}
\usepackage[makeindex,nomain]{glossaries-extra}
\newglossary[nlg]{notation}{not}{ntn}{Symbols}
\makeglossaries
\newcommand{\booleanSetSymbol}{\mathbb{B}}%%% for pdflatex
% \newcommand{\booleanSetSymbol}{𝔹}%%% for lualatex
\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix}{m}{n}
\DeclareSymbolFont{stixsymbols2}{LS1}{stixfrak}{m}{n}%%% for \typecolon (we call is \hasSortSymbol) ⦂ (U+2982)
\newcommand{\hasSortSymbol}{{\fontencoding{LS1}\fontfamily{stixfrak}\selectfont\smaller\char"25}}%%% for pdflatex
% \newcommand{\hasSortSymbol}{⦂}%%% for lualatex
%\usepackage{unicode-math}%%% for lualatex
\glssetcategoryattribute{mathrelation}{hyperoutside}{false}
\glssetcategoryattribute{mathrelation}{textformat}{mathrel}
\newglossaryentry{not:booleanValues}{type=notation, name=\(\booleanSetSymbol\), text=\booleanSetSymbol, description={The set of Boolean values.}}
\newglossaryentry{not:function}{type=notation, name={\(\_\mathord{\to}\_\)}, text={\_\to\_}, sort={function}, description={The notation \(X{\to}Y\) means the set of all functions with domain \(X\) and codomain \(Y\). Following Bourbaki, we see a function as a triple (function graph, domain, codomain); a function \(f\penalty1\in\penalty1 X{\to}Y\), traditionally written as \(f\colon\penalty1 X\penalty2\to\penalty2 Y\), is thus \(\bigl(\mskip-1mu plus.5mu minus.5mu\{(x,f\mskip-.4mu plus.2mu minus.2mu (x\mskip-.3mu plus.15mu minus.15mu)\mskip-.5mu plus.25mu minus.25mu)\penalty2\mid\penalty1 x\mskip-3mu plus1mu minus1mu\in\mskip-3mu plus1mu minus1mu X \penalty3\land\penalty3 y\mskip-3mu plus1mu minus1mu\in\mskip-3mu plus1mu minus1mu Y\},\penalty1 X,\penalty1 Y\mskip-.3mu plus.15mu minus.15mu\bigr)\).}, user1={function}, user2={functions}, user3={map}, user4={maps}, user5={\colon}, user6={\to}}
\newglossaryentry{not:hasSort}{type=notation, name={\hasSortSymbol}, category=mathrelation, text={\text{\hasSortSymbol}}, sort={:}, description={Typing relation: \(x\mathrel{\text{\hasSortSymbol}} S\) means that the variable \(x\) has sort \(S\).}}
\begin{document}%
\newlength{\myLen}\setlength{\myLen}{32em}%
\noindent Line 1. With gls:\\
\hspace*{\myLen}\(f\gls{not:hasSort}\Sigma\mathrel{\glsuservi{not:function}}\gls{not:booleanValues}\)\\
\noindent Line 4. With gls and wrgloss=after:\\
\hspace*{\myLen}\(f\gls{not:hasSort}\Sigma\mathrel{\glsuservi{not:function}}\gls[wrgloss=after]{not:booleanValues}\)\\
\noindent Line 7.
\renewcommand*{\glslinkwrcontent}[1]{#1}%%% a quick hack according to the text concerning v1.48 in http://mirrors.ctan.org/macros/latex/contrib/glossaries-extra/CHANGES .  Without this hack, as above, the distances around \gls{not:hasSort} are improper: it should be spaced as mathrel, but it isn't.  With this hack, as below, there is a spurious space after an automatic line break.
With gls:\\
\hspace*{\myLen}\(f\gls{not:hasSort}\Sigma\mathrel{\glsuservi{not:function}}\gls{not:booleanValues}\)\\
\noindent Line 10. With gls and wrgloss=after:\\
\hspace*{\myLen}\(f\gls{not:hasSort}\Sigma\mathrel{\glsuservi{not:function}}\gls[wrgloss=after]{not:booleanValues}\)\\
\noindent Line 13.
\printglossaries
\end{document}

Evaluation

I'm sorry, I don't have sufficient knowledge of whatsits and math-mode spacing. I suggest you post a follow-up to your question on StackExchange if the neither of the suggestions below work.

The default definition of \glslinkwrcontent with wrgloss=before should reproduce egreg's suggestion of {⟨whatsit⟩⟨term⟩}.

David's suggestion of just grouping the whatsit can be implemented by redefining \glswriteentry. The second argument is the whatsit. The definition varies depending on whether or not you are using glossaries-extra or just the base glossaries package.

With just the base glossaries package, the grouping can be added with the following redefinition:

\renewcommand*{\glswriteentry}[2]{%
  \ifglsindexonlyfirst
    \ifglsused{#1}{}{{#2}}%
  \else
    {#2}%
  \fi
}%
With glossaries-extra, it's more complicated to allow for additional features:
\renewcommand*{\glswriteentry}[2]{%
  \glsxtrifindexing
  {%
   \ifglsindexonlyfirst
     \GlsXtrIfUnusedOrUndefined{#1}
     {{#2}}%
     {\glsxtrdoautoindexname{#1}{dualindex}}%
   \else
     \glsifattribute{#1}{indexonlyfirst}{true}%
     {%
       \GlsXtrIfUnusedOrUndefined{#1}%
       {{#2}}%
       {\glsxtrdoautoindexname{#1}{dualindex}}%
     }%
     {{#2}}%
   \fi
  }%
  {}%
}%

The next version of glossaries-extra (v1.49) will remove the grouping from \glslinkwrcontent and just add it around the actual whatsit. This seems to fix the issue.

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