使用 unicode-math 和 lualatex 的平方根高度不正確

使用 unicode-math 和 lualatex 的平方根高度不正確

這就是我所看到的:在此輸入影像描述 請注意 \sqrt{11} 中平方根符號高度的差異。這似乎只有當我用 編譯時才會發生lualatex

這是我的 MWE:

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont[]{TeX Gyre Pagella Math}
\setmathfont[range={cal}]{Latin Modern Math}

\begin{document}
  Note well:
  \begin{equation*}
    x = \sqrt{11}\sqrt{19}
    \qquad
    y = \frac{\sqrt{11}\sqrt{19}}{26}
  \end{equation*}
\end{document}

我認為這是一個錯誤,但我不確定是否是這種情況,或者如果是的話如何報告。

答案1

這是該選項的一個已知“功能” range。您可以透過將主要字體重新設定為最後一種數學字體來解決此問題,並選擇它作為某些符號的範圍。

作者unicode-math是意識到這一點的。

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont[]{TeX Gyre Pagella Math}
\setmathfont[range={cal}]{Latin Modern Math}
\setmathfont[range=\int]{TeX Gyre Pagella Math}

\begin{document}
  Note well:
  \begin{equation*}
    x = \sqrt{11}\sqrt{19}
    \qquad
    y = \frac{\sqrt{11}\sqrt{19}}{26}
  \end{equation*}
\end{document}

在此輸入影像描述

答案2

不只是根的高度有問題,仔細看還可以發現根的水平規則不對,分數規則也太細了。正如egreg所寫,這是範圍選項的問題。最後一個數學字體設定重要的數學常數。在這種情況下,問題出在 和 上\Umathradicalrule\Umathfractionrule正如您在本範例中看到的:

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont[]{TeX Gyre Pagella Math}
\makeatletter\check@mathfonts \makeatother
\edef\textstylerulewidth{\the\Umathradicalrule\textstyle}
\edef\displaystylerulewidth{\the\Umathradicalrule\displaystyle}
\edef\displaystylefraction{\the\Umathfractionrule\displaystyle}

\setmathfont[range={cal}]{Latin Modern Math}


\begin{document}
\makeatletter\check@mathfonts \makeatother
\Umathradicalrule\textstyle=\textstylerulewidth 
\Umathradicalrule\displaystyle=\textstylerulewidth 
\Umathfractionrule\displaystyle=\displaystylefraction
  Note well:
  \begin{equation*}
    x = \sqrt{11}\sqrt{19}
    \qquad
    y = \frac{\sqrt{11}\sqrt{19}}{26}
  \end{equation*}
\end{document}

(像這樣一一設定值自然不是可行的方法,egreg 的解決方案更好,但恕我直言,看看這個值如何影響輸出是很有趣的。)

相關內容