Bug Tracker 
| ID | 194🔗 |
|---|---|
| Submitted by: | Peter Müller |
| Date: | 2021-12-30 11:08:57 |
| Last update: | 2023-01-10 10:28:10 |
| Status | Closed (Fixed) 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 {⟨⟩⟨⟩}.
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.
Update 2022-10-19: fixed in glossaries v4.50 and glossaries-extra 1.49 (make sure to update mfirstuc at the same time).
Comments
4 comments.
Date: 2023-01-07 14:45:52
Repying to: Peter Müller 2023-01-06 01:48:42
Regardless of whether or not you use hyperref, you will need hyperoutside=false in this case. This is because both \glsdonohyperlink (used with hyper=false) and \glsxtrdohyperlink (used with hyper=true) create implicit grouping. Both commands need to be inside \mathrel to prevent the grouping from causing a problem with spacing.
Date: 2023-01-10 10:28:00
Repying to: Peter Müller 2023-01-06 01:48:42
I've added an answer to the TeX.SX question.
Add Comment
Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=194

Date: 2023-01-06 01:48:42
Yes, you fixed this. Thanks!!! And at the same time, in TeX Live 2022 as of today, a problem with relations and spacing seems to have emerged (which may be related or not), cf. https://tex.stackexchange.com/questions/670771 .