1

I would like to create a font that uses palatino (or pagella) for the text but euler for the math. If I understand correctly the documentation, it should be achievable with typefaces, but I can't get it to working : all the text is in Latin. Here is a MWE inspired from the doc :

\starttypescript [perso] [texnansi, ec, qx, t5, default]
  \definetypeface[perso] [rm] [Xserif] [palatino] [default]
  \definetypeface[perso] [tt] [Xmono] [palatino] [default]
  \definetypeface[perso] [mm] [Xmath] [euler] [default]
\stoptypescript

\starttext

\setupbodyfont[perso]
Bonjour les ami·e·s
\startformula
  x + 3 = \mathcal{P}
\stopformula

\setupbodyfont[palatino]
Bonjour les ami·e·s
\startformula
  x + 3 = \mathcal{P}
\stopformula

\stoptext

enter image description here

What am I doing wrong ?

Thank you in advance

7
  • Have you tried \setupbodyfont[euleroverpagella] or \setupbodyfont[pagellaovereuler]? If none of them fit your needs, you can look in the file type-imp-euler.mkiv and see how that was done and make your own typescript file (better leave that one without modification and add your own locally).
    – mickep
    Commented Aug 24, 2023 at 8:46
  • Each of them have the same behavior and switches all pagella for latin… Commented Aug 24, 2023 at 8:53
  • I get this. No Latin Modern.
    – mickep
    Commented Aug 24, 2023 at 9:02
  • Well, maybe there's a problem with my distribution, but its a standalone… However the pagella-with-euler works here. I really don't understand, but at least it works Commented Aug 24, 2023 at 9:06
  • 1
    @MaxChernoff I agree that it is weird. I can talk to Hans about it. (I think these can be seen as some left overs from somebody who wanted to mix these fonts in various ways a long time ago.)
    – mickep
    Commented Aug 24, 2023 at 9:19

1 Answer 1

2

I would like to create a font that uses palatino (or pagella) for the text but euler for the math.

ConTeXt already has a builtin solution for this:

\setupbodyfont[pagella-with-euler]

\startTEXpage
    Euler's Formula: $e^{i\pi} + 1 = 0$
\stopTEXpage

enter image description here

Regarding the code you posted:

\starttypescript [perso] [texnansi, ec, qx, t5, default]  
  \definetypeface[perso] [rm] [Xserif] [palatino] [default]  
  \definetypeface[perso] [tt] [Xmono] [palatino] [default]  
  \definetypeface[perso] [mm] [Xmath] [euler] [default]
\stoptypescript

\starttext

\setupbodyfont[perso]
  1. Listing the encodings is deprecated for almost a decade now.
  2. You should use serif instead of Xserif, and mono instead of Xmono, … .
  3. ConTeXt doesn't define a font with the name euler, so you need to actually use eulernova (which is essentially the same thing).
  4. \setupbodyfont is best before \starttext (to prevent loading the LM fallback font).

So:

\setuppagenumbering[state=stop]

\starttypescript [perso]
    \definetypeface[perso] [rm] [serif] [palatino]  [default]
    \definetypeface[perso] [tt] [mono]  [palatino]  [default]
    \definetypeface[perso] [mm] [math]  [eulernova] [default]
\stoptypescript
\setupbodyfont[perso]

\starttext
    Bonjour les ami·e·s

    \startformula
    x + 3 = \mathcal{P}
    \stopformula
\stoptext

enter image description here

5
  • 1
    I think eulernova at some point changed name into euler-math. (But maybe not in the typescripts... Sorry)
    – mickep
    Commented Aug 24, 2023 at 9:03
  • @mickep Yeah, type-imp-euler.mkxl:26--29 has (essentially) \starttypescript[eulernova] \definefontsynonym[Serif][file:euler-math.otf] \stoptypescript. I guess a euler -> eulernova alias should probably be added, similar to the current palatino -> pagella Commented Aug 24, 2023 at 9:09
  • Thank you, this is very clear ! I don't know why pagella-euler, pagellaovereuler and euleroverpagella didn't work on my computer, but pagella-with-euler does. However the math symbols behave strangely : I edit the OP to show the problem. Commented Aug 24, 2023 at 9:11
  • Please don't change the question in case this answered your problem as stated. Better then ask a new question and refer to this one.
    – mickep
    Commented Aug 24, 2023 at 9:13
  • Ok, I cancel the edit and open a new subject Commented Aug 24, 2023 at 9:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .