# How to get the alternate open g with unicode-math and Libertinus Math?

I was using newtxmath with the libertine option (so Linux Libertine) with pdflatex engine before, but switched to unicode-math in xelatex.

newtxmath provided me with a nice open italic g, which seem to be the preferred form for mathematics. I don't know how to get that with unicode-math and the Libertinus math font (best choice for Linux Libertine). I dug in newtxmath.sty but couldn't find any useful information of what the package does to get the open g. I searched through Linux Libertine glyph tables and couldn't find it either.

pdflatex MWE with the desired open g:

\documentclass{standalone}

\usepackage[libertine]{newtxmath}

\begin{document}
$$g$$
\end{document}


xelatex / unicode-math MWE with regular g:

\documentclass{standalone}

\usepackage{unicode-math}
\setmathfont{Libertinus Math}

\begin{document}
$$g$$
\end{document}


Possible solutions I can think of:

• Analyse how newxmath creates the open g and use that
• import the open g as vector graphics and make it a math letter, if possible
• Use just the open g of Linux Libertine (if there is one) together with Libertinus.
• There is no open g in Libertinus Math. – Henri Menke Apr 12 '17 at 21:12
• I'm not sure that “the open form is preferred in math”. – egreg Apr 12 '17 at 21:43
• @egreg: I found my source: the german book “Detailtypografie” has a chapter on typesetting math, made by Johannes Küster. It is stated that the open g is preferred, but it might be limited to german math typesetting ... – lblb Apr 21 '17 at 20:06

Imho newtxmath use this font with the option libertine for the g

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Libertinus Math}
\DeclareFontFamily{OML}{nxlmi}{\skewchar \font =127}
\DeclareFontShape{OML}{nxlmi}{m}{it}{
<-6.3>  nxlmi035
<6.3-8.6> nxlmi037
<8.6->  nxlmi03
}{}
\DeclareSymbolFont{gletters}{OML}{nxlmi}{m}{it}
\DeclareMathSymbol{g}{\mathalpha}{gletters}{g}
\begin{document}
$$abc fg$$
\end{document}


You can use the open g from newtxmath by declaring the symbol. However, the fd file includes severals \if statements which have to be declared beforehand; but the font shapes can be defined directly. (Probably doesn't work with bold math)

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Libertinus Math}

\DeclareFontFamily{U}{ntxmia}{\skewchar\font=127 }
\DeclareFontShape{U}{ntxmia}{m}{it}{<->nxlmia}{}
\DeclareFontShape{U}{ntxmia}{b}{it}{<->nxlbmia}{}
\DeclareSymbolFont{lettersA}{U}{ntxmia}{m}{it}
\SetSymbolFont{lettersA}{bold}{U}{ntxmia}{b}{it}
\DeclareMathSymbol{g}{\mathord}{lettersA}{49}

\begin{document}

$\mitg$ $g$

$\mathbfit{g}$ \boldmath$g$\unboldmath

\end{document}
`

• I've taken the liberty of modifying the code in order to avoid loading the (complicated) fd file. Feel free to revert. – egreg Apr 12 '17 at 21:42