# Using standard Libertine italic g and w in math mode with newtxmath

I'd like to use the Libertine italic w and g as math italic letters, rather than the variant letters employed by newtxmath with the libertine option. The option liby allows one to revert to the Libertine y. What is the simplest way to accomplish the same for w and g?

Note 1: I know there might be good reasons to prefer a single-story g in mathematics. Here, I would like to use the double-story version.

Note 2: I'm aware of K. Hosny's Libertinus Math – and keeping an eye on its development. At the moment, I'd prefer to stick with pdfLaTeX/Type 1 fonts.

I think you are talking about “g” and “v”, because the “w” is exactly the same as the italic one.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}

\makeatletter
\DeclareSymbolFont{altitalic}{\tx@enc}{\rmdefaultB}{m}{it}
\SetSymbolFont{altitalic}{bold}{\tx@enc}{\rmdefaultB}{b}{it}
\DeclareMathSymbol{g}{\mathord}{altitalic}{g}
\DeclareMathSymbol{v}{\mathord}{altitalic}{v}
\DeclareSymbolFontAlphabet{\mathit}{altitalic}
\makeatother

\begin{document}
$abgwv$ \textit{gwv} $\mathit{abgwv}$
\end{document}

Here's the output without the changes:

Without a new symbol font:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}

\mathchardef\mathg=\numexpr"7000+g\relax
\mathchardef\mathv=\numexpr"7000+v\relax
\begingroup\lccode~=g \lowercase{\endgroup\def~}{\mathit{\mathg}}
\begingroup\lccode~=v \lowercase{\endgroup\def~}{\mathit{\mathv}}
\AtBeginDocument{%
\mathcodeg="8000
\mathcodev="8000
}

\begin{document}
$abgwv$ \textit{gwv} $\mathit{abgwv}$
\end{document}