newtxmath 與 libertine:下​​標中的“g”不同

newtxmath 與 libertine:下​​標中的“g”不同

以下範例在簡單下標中給出了不同的“g”:

\documentclass{article}

\usepackage{mathtools,amssymb}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}


\begin{document}
\[g \ \mu_g \ A_{\mu_g}\]

\end{document}

有沒有快速的方法來解決這個問題? (編按:使用 MiKTex 2.9.7250,用背頁編譯相同的程式碼給我下標中的「正確」'g'。)

編輯:此問題已在版本 1.612 (2019-12-01) 中修復。

在此輸入影像描述

答案1

顯然,該nxlmi字體在尺寸 10 和 5 處有錯誤的字形,而在尺寸 7 處有正確的字形。

在問題在字體層級解決之前,您可以透過告訴 LaTeX 從不同的字體中獲取“g”來解決它。

\documentclass{article}

\usepackage{mathtools,amssymb}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}

\DeclareSymbolFont{libertineg}{\encodingdefault}{\familydefault}{m}{it}
\SetSymbolFont{libertineg}{bold}{\encodingdefault}{\familydefault}{b}{it}
\DeclareMathSymbol{g}{\mathalpha}{libertineg}{`g}

\begin{document}

\[g \ \mu_g \ A_{\mu_g}\ \textit{g}\]

\end{document}

在此輸入影像描述

如果你想要“變體g”,那就有點複雜了:我們只需要在腳本樣式中縮小文字樣式“g”。

\documentclass{article}

\usepackage{mathtools,amssymb}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{xfp,graphicx}

\newcommand{\fixg}{{%
  \mathchoice
    {\normalg}% displaystyle
    {\normalg}% textstyle
    {\scaledg}% scriptstyle
    {\normalg}% scriptscriptstyle
}}
\makeatletter
\newcommand{\scaledg}{%
  \scalebox{\fpeval{\sf@size/\f@size}}{$\m@th\normalg$}%
}
\begingroup\lccode`~=`g \lowercase{\endgroup\let~\fixg}
\edef\normalg{\mathchar\the\mathcode`g }
\AtBeginDocument{\mathcode`g="8000 }

\begin{document}

\[g \ \mu_g \ A_{\mu_g}\]

\end{document}

在此輸入影像描述

相關內容