# Conflict in math mode numerals between packages gfsporson and newtxmath in pdfLaTeX

I'd like to use, for pdfLaTeX compilation, the package gfsporson for Greek typesetting (within a larger LaTeX setup than the MWE below) together with newtxmath after newtxtext, but I've just found that the former conflicts in some way with the math-mode numerals and sets the default cmr-based typefaces instead of those provided by the newtxmath package (actually taken from newtxtext).

I would appreciate a solution that allows me to use both packages with the math-mode numerals as set by the newtx "bundle".

Follows an MWE:

\documentclass{memoir}

%\usepackage{gfsporson} %<- uncomment to check for the difference in math mode

\usepackage{newtxtext}
\usepackage{newtxmath}

\begin{document}
123 $123$
\end{document}


Unless you need the Porson symbol font for something else - it is only used for the numbers as configured by the package - you can override it easily by just redefining that font. Otherwise, you'd need to undo the specific changes it makes, as Steven B. Segletes suggests. But since you want to avoid it affecting maths completely, this seems pretty safe.

\documentclass{memoir}
\usepackage{gfsporson} %<- uncomment to check for the difference in math mode
\usepackage{newtxtext}
\usepackage{newtxmath}
\DeclareSymbolFont{porsonnumbers}{OT1}{qtm}{m}{n}
\begin{document}
123 $123$
\end{document}


• I ended up using this solution. It was the simplest in that it didn't rely on loading an extra package and it was just a single line long. – Marcos Oct 16 '17 at 8:28

You have to undo the gfsporson declaration of making the numerical digits belong to the symbol font porsonnumbers. In the style file, you will find this

\DeclareSymbolFont{porsonnumbers}{OT1}{porson}{m}{n}
\DeclareMathSymbol{0}{\mathalpha}{porsonnumbers}{0}
\DeclareMathSymbol{1}{\mathalpha}{porsonnumbers}{1}
\DeclareMathSymbol{2}{\mathalpha}{porsonnumbers}{2}
\DeclareMathSymbol{3}{\mathalpha}{porsonnumbers}{3}
\DeclareMathSymbol{4}{\mathalpha}{porsonnumbers}{4}
\DeclareMathSymbol{5}{\mathalpha}{porsonnumbers}{5}
\DeclareMathSymbol{6}{\mathalpha}{porsonnumbers}{6}
\DeclareMathSymbol{7}{\mathalpha}{porsonnumbers}{7}
\DeclareMathSymbol{8}{\mathalpha}{porsonnumbers}{8}
\DeclareMathSymbol{9}{\mathalpha}{porsonnumbers}{9}


So it must be reset in the preamble of your document.

\documentclass{memoir}
\usepackage[T1]{fontenc}

\usepackage{gfsporson} %<- uncomment to check for the difference in math mode

\usepackage{newtxtext}
\usepackage{newtxmath}

\DeclareMathSymbol{0}{\mathalpha}{letters}{0}
\DeclareMathSymbol{1}{\mathalpha}{letters}{1}
\DeclareMathSymbol{2}{\mathalpha}{letters}{2}
\DeclareMathSymbol{3}{\mathalpha}{letters}{3}
\DeclareMathSymbol{4}{\mathalpha}{letters}{4}
\DeclareMathSymbol{5}{\mathalpha}{letters}{5}
\DeclareMathSymbol{6}{\mathalpha}{letters}{6}
\DeclareMathSymbol{7}{\mathalpha}{letters}{7}
\DeclareMathSymbol{8}{\mathalpha}{letters}{8}
\DeclareMathSymbol{9}{\mathalpha}{letters}{9}

\begin{document}
123 $123$
\end{document}


The gfsporson package seizes the initiative and redefines the math symbol tables to use Porson for the digits.

It's much better to use substitutefont:

\documentclass{memoir}
\usepackage[polutonikogreek,english]{babel}

\usepackage{newtxtext}
\usepackage{newtxmath}
\usepackage{substitutefont}

\substitutefont{LGR}{\rmdefault}{porson}

\begin{document}
123 $123$

\textgreek{abgdezhq}

\end{document}


• Mightn't somebody want the text font commands the package declares, though? – cfr Jul 6 '17 at 17:26
• @cfr They don't work anyway, as far as I can see. – egreg Jul 6 '17 at 17:40
• @egreg: I have tried your solution, but I still get the CMR numerals in math mode – Marcos Jul 6 '17 at 18:21
• @Marcos Not with my example; if your real document is more complex, the problem may lie elsewhere. – egreg Jul 6 '17 at 19:26
• @egreg: Right, but my mistake was a different one. I thought I was using just the same lines of code as in your example and I've just noticed that I was still loading gfsporson, which of course is supposed not to be loaded now. Your solution works right. I just have to ponder over which one I find more convenient, cfr's or yours. Although Segletes's works fine, too, I find it rather less convenient. – Marcos Jul 6 '17 at 20:28