Am 08.09.2025 um 02:43 schrieb Kip Warner:
On Sat, 2025-09-06 at 09:37 +0200, Hans Hagen wrote:
Hello Hans,
Symbols like \reals are coming from a math font and since luatex we
also handle them (as an escape) in text mode (instead or erroring).
If no proper math font is loaded you don't get them. And as already
explained one has to explicitly switch to a bold math font in your
case.
I did try that already, explicitly switching to a bold math font, but
wasn't able to get it to work.
Now, if you don't know the dirty internal details, here is an
approach
that does some checking.
\starttext
\starttexdefinition protected myreals
\ifmmode
\reals
\orelse\iffontchar\font\mathcharslot\reals
\char\mathcharslot\reals
\else
\im{\reals}
\fi
\stoptexdefinition
\starttexdefinition protected myboldreals
{
\ifmmode
\mb\reals
\else
\bf
\iffontchar\font\mathcharslot\reals
\char\mathcharslot\reals
\else
\egroup
\im{\mb\reals}
\bgroup
\fi
\fi
}
\stoptexdefinition
\myreals {\myboldreals}
\im {\myreals {\myboldreals}}
\stoptext
Alternatively you could use symbols and getglyph etc and get auto
adaptation to style then.
Now, if you really want to go dirty ... you can define a math symbol
that takes from the bold family:
\Umathchardef\boldreals
\mathcharclass\reals
\plusthree % \c_font_fam_mb
\mathcharslot\reals
Here we preserve some properties like class. Of course this assumes
that
we never change the math machinery (in this case unlikely as we're
talking of normal versus bold math but it's not in the official mathb
manual until Mikael agrees on this).
\reals \boldreals
This seems to work ok here. It all depends on use cases.
I appreciate your help, but unfortunately that's all quite convoluted
for me, given the current state of the documentation and trying to
understand what your code does. I'm just trying to typeset a single
bold character for a standard mathematical set.
The following is a minimal that demonstrates my problem. If I comment
out any of the first three lines, the first R is bold as expected. If I
leave all of the first three uncommented, both Rs are not bold:
\setupbodyfont[11pt]
\definefontfamily[main_font][serif][titilliumweb]
Add a math font:
\definetypeface[main_font][mm][math][modern]
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________