12

The following example gives me a different 'g' in the simple subscript:

\documentclass{article}

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


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

\end{document}

Is there a quick way to fix this? (EDIT: Using MiKTex 2.9.7250, compiling the same code with overleaf gives me the "right" 'g' in the subscript.)

EDIT: This been has been fixed in Version 1.612 (2019-12-01).

enter image description here

  • 3
    Seems like a simple oversight. The gs work fine if the libertine option is not active. Contact the maintainer of newtxmath and tell them about it (the project README on CTAN has an email address at the end). – moewe Dec 1 '19 at 7:10
  • 1
    If you are ok with the “two-storey” shape for the lowercase letter g in text, script, and scriptscript math style, I suggest you replace \usepackage[libertine]{newtxmath} with \usepackage{libertinust1math}. (Aside: Michael Shell is the author of both packages.) Note that the latter package does not offer a varg option at present; hence, no single-storey g in math mode. – Mico Dec 1 '19 at 8:22
  • @moewe Thanks, will do. – Pete Dec 1 '19 at 10:45
  • Seems to have been fixed by the maintainer: tug.org/pipermail/tex-live-commits/2019-December/011722.html – moewe Dec 3 '19 at 6:34
10

Apparently, the nxlmi font has the wrong glyph at sizes 10 and 5, while it has the right one at size 7.

Until the issue is fixed at the font level, you can somewhat fix it by telling LaTeX to get the “g” from a different font.

\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}

enter image description here

If you want the “variant g”, it's a bit more complicated: we need to scale down the text style “g” only when in script style.

\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}

enter image description here

| improve this answer | |
  • Thanks for your answer. I shuld have mentioned that I would like to keep the 'varg' in all instances, i.e., the first 'g' in my picture. Is there a way to adjust the code? – Pete Dec 1 '19 at 10:46
  • @Pete I wouldn't, but here it is. – egreg Dec 1 '19 at 11:14
  • Thank you! The 'varg' seems to be version intended by the package author (at least with option 'libertine' active). Why would you advise against it? – Pete Dec 1 '19 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.