I want to typeset text fractions with potentially arbitrary text instead of just numbers. A solution was presented here and this is my ConTeXt implementation:
\usetypescriptfile[ibmplex]
\setupbodyfont[ibmplex, 12pt]
\definefontfeature[numr][default][numr=yes]
\definefontfeature[dnom][default][dnom=yes]
\definehighlight[textnumr][default][style={\feature[+][numr]}]
\definehighlight[textdnom][default][style={\feature[+][dnom]}]
\definefontfeature[frac][default][frac=yes]
\definehighlight[textfrac][default][style={\feature[+][frac]}]
\def\fancyfrac#1#2{\textnumr{#1} \Uchar"2044 \textdnom{#2}}
\starttext
\fancyfrac{1}{8} % The 1 is not properly kerned
\textfrac{1/8} % Proper kerning
\stoptext
However, it seems that the numr
feature is not working properly. In the log there is a line that reads:
system > error: invalid parent default for textnumr, default defined too (best check it)
For the record I'm using the latest lmtx
on Ubuntu 18.04. Does anyone know what the issue here is?
[EDIT]: I hacked together a solution based on the answer provided by Wolfgang that appears to work very well (even though I have no idea why):
\setupbodyfont [ibmplex]
\definefontfeature [f:numr] [numr=yes]
\definefontfeature [f:dnom] [dnom=yes]
\definefontfeature [f:frac] [frac=yes]
\define[2]\AugmentedVulgarFraction{\feature[+][f:frac]\vulgarfraction{{\feature[+][f:numr]#1}\:}{\:\feature[+][f:dnom]#2}}
[EDIT 2]: Upon further discussion with Wolfgang I ended up using the following macro:
\definesymbol[vulgarfraction][\textfraction]
\define[2]\TextFraction{\chardef\vulgarfractionmethod2\vulgarfraction{#1}{#2}}
\vulgarfraction
use\setconstant\vulgarfractionmethod=2
(the=
is optional) or\setconstant\vulgarfractionmethod\plustwo
(\plustwo = 2). – Wolfgang Schuster Jun 23 '20 at 12:58