2

I am using NCM (NewComputerModern) as my main font. Because I do not like the \mathcal{…} provided by unicode-math in the Euler font instead of the Latin Modern oder Computer Modern style.

I think that I am switching to Computer Modern Symbol (cmsy) with

\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}

I got the cmd from here.

This causes the \hat{…} cmd to be slightly off-center if you compare it without unicode-math in Latin Modern Math.

The first is with the Euler Font. I think the spacing of the mathcal letters is being used to set the hat symbol which causes it to be slightly off-center (I could be wrong though).

enter image description here

How do I get the "correct" position?

This is how it should look like (although the hat symbol has a weird width in this one):

enter image description here

MWE:

\documentclass{scrartcl}
\usepackage{unicode-math}
\setmainfont{NewCM10-Book.otf}
\setmathfont[CharacterVariant=1]{NewCMMath-Book.otf}
\setmathfont[range={scr,bfscr}]{XITS Math}
\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}

\begin{document}
    $\hat{\mathcal{J}} \hat{\mathcal{K}} $
\end{document}

Similar posts: here and here

1
  • 1
    As always please post a full bit minimal example that others can copy and test as is. Then it is easier to know what you are doing and what setup your a re working with.
    – daleif
    Commented Mar 15, 2022 at 12:19

1 Answer 1

2

I think that I may have found a "better" solution than what I was using before.

I am assuming (but really just guessing) that with \DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n} internally the font-shape and width of the characters by the other font was used which caused the misaligned \hat{…} for \mathcal{J} and \mathcal{K}.

After testing and trying I came to look up what cmsy is actually called as a file that is installed.

It turns out that the file is called cmsy10 (actually ranging from 5 to 10; so cmsy5, cmsy6, …).

So now to the fixed MWE:

\documentclass{scrartcl}
\usepackage{unicode-math}
\setmathfont[CharacterVariant=1]{NewCMMath-Book.otf}
\setmathfont[range={scr,bfscr}]{XITS Math}
\setmathfont[range={cal}]{cmsy10} % the FIXED implementation of the CM Calligraphic Font
\setmathfont[StylisticSet=1,range={bfcal}]{XITS Math} % not necessary but allows also for bfcal

\begin{document}
    $\hat{\mathcal{J}} \hat{\mathcal{K}} $
    \\[2ex]
    $\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$
    \\[2ex]
    $\mathbfcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$
    \\[2ex]
    $\mathscr{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$
    \\[2ex]
    $\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$
    \\[2ex]
    $\mathbb{abcdefghijklmnopqrstuvwxyz}$
\end{document}

enter image description here

You must log in to answer this question.

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