#StackBounty: #xetex #hyperref #kerning #makeindex #glossaries-extra Proper kerning in case the symbol with a subscript is a glossary t…

Bounty: 500

Continuing How to get glossary terms to properly typeset subscripts/superscripts?, let’s consider the following input:

documentclass{book}
usepackage{fontspec}
usepackage[ngerman]{babel}
usepackage{mathtools}mathtoolsset{mathic=true} %%% See http://tex.stackexchange.com/a/3496/
usepackage{amssymb}
usepackage{unicode-math}
setmainfont[Ligatures=TeX]{TeX Gyre Termes}
setsansfont{TeX Gyre Heros}[Scale=0.88]
setmonofont{TeX Gyre Cursor}
setmathfont[Ligatures=TeX]{TeX Gyre Termes Math}
setmathfont[Ligatures=TeX,range={setminus}]{Asana Math}
setmathfont[Ligatures=TeX,Extension=.otf,range={"2A3E},BoldFont=XITSMath-Bold]{XITSMath-Regular}%%% The fat semicolon
usepackage[unicode,hidelinks]{hyperref}
usepackage[makeindex,toc,nogroupskip,nomain]{glossaries-extra} %%% glossaries-extra internally loads glossaries, and glossaries according to its documentation should be loaded after hyperref.
%%% The next hack improves how hyperref jives with svindd.ist, see https://tex.stackexchange.com/a/429446
makeatletter
def@commahyperpage#1{@@commahyperpage#1,,,\}
def@@commahyperpage#1,,#2,#3\{%
  ifx\#2\%
    HyInd@pagelink{#1}%
  else
    HyInd@pagelink{#1},,HyInd@pagelink{#2}%
  fi
}
makeatother
setglossarystyle{long3col}renewcommand{glspagelistwidth}{10em}
GlsSetQuote{+} %%% Hack to work with makeindex
usepackage[babel=true,verbose=errors]{microtype}
newcommand{NNZ}{gls{not:nonnegativeNat}}% ℕ_{}
newcommand{NNP}{gls{not:positiveNat}}
newcommand{finiteWordsSet}[1]{#1^{gls{not:finiteWordsSymbol}}} %%% Sequences
newglossary[nlg]{notation}{not}{ntn}{Symbolverzeichnis}
makeglossaries
newglossaryentry{not:positiveNat}{type=notation, name={(ℕ_{mkern-2mu>0})}, text={ℕ_{mkern-1mu>0}}, sort={Nplus}, description={Die Menge positiver ganzer Zahlen.}}
newglossaryentry{not:nonnegativeNat}{type=notation, name={(ℕ_{mkern-2muge 0})}, text={ℕ_{mkern-1muge 0}}, sort={N0}, description={Die Menge nichtnegativer ganzer Zahlen.}}
newglossaryentry{not:finiteWordsSymbol}{type=notation, name={(cdot^*)}, text={*}, sort={*finiteWordsSymbol}, description={Gegeben eine beliebige Menge (Z), bezeichnen wir mit (Z^*) die Menge aller endlichen Wörter (also, endlichen Sequenzen) über (Z).}}
begin{document}
What we typeset is:
[finiteWordsSet{NNZ} finiteWordsSet{NNP}]
(finiteWordsSet{NNZ} finiteWordsSet{NNP})

bigskip

However, the visual appearence leaves much to be desired. The star should better be closer to the double-struck capital N and a little bit higher, such as in
[ℕ^{raisebox{.1ex}{$scriptstyle *$}}_{mkern-2mu>0} ℕ_{mkern-2muge 0}^{raisebox{.1ex}{$scriptstyle *$}}]
(ℕ_{mkern-2mu>0}^{raisebox{.1ex}{$scriptstyle *$}} ℕ_{mkern-2muge 0}^{raisebox{.1ex}{$scriptstyle *$}})\
and all the symbols should be still properly linked to the glossary.
printglossary
end{document}

Compiling with xelatex file && makeindex -g -s file.ist -t file.nlg -o file.not file.ntn && xelatex file gives us this:

output with unpleasant kerning

How to adapt the code in such a way that the macro calls finiteWordsSet{NNZ} and finiteWordsSet{NNP} produce a visually pleasant output without losing the links to the glossary and perform as before for the other actual arguments? If that’s too difficult, I’d even appreciate single macros finiteWordsOverNaturalsZ and finiteWordsOverNaturalsP that would produce the visually pleasant representation of the notation for sequences of naturals with/without zero?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.