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]
   \setupbodyfont[main_font]
   
   \define\boldnaturalnumbers{\im{\mb \naturalnumbers}}
   \define\boldintegers{\im{\mb \integers}}
   \define\boldrationals{\im{\mb \rationals}}
   \define\boldreals{\im{\mb \reals}}
   \define\boldcomplexes{\im{\mb \complexes}}
   \define\boldprimes{\im{\mb \primes}}
   
   \starttext
   \boldreals\ \reals
   \stoptext

The reason why I have the first three lines in the minimal is because
my project relies on them in my environment file in order to ensure the
rest of the document is typeset in the correct typeface.

-- 
Kip Warner
OpenPGP signed/encrypted mail preferred
https://www.thevertigo.com

Attachment: signature.asc
Description: This is a digitally signed message part

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
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
___________________________________________________________________________________

Reply via email to