# Problem using a font from newtxmath

I'm trying to set up my preferred mix of fonts from mathptmx and newtxmath. This would require using the largsymbols font from newtxmath, since I like its integrals better than those from mathptmx. However, this one font just won't load. Here is a simple snippet illustrating the problem:

\documentclass[a4paper]{report}
\DeclareSymbolFont{largesymbols}{OMX}{ntxex}{m}{n}

\begin{document}
$\forall\exists<>\leq\geq\int\subseteq\supseteq$
$\int abcdefghijklmnopqrstuvwxyz+-=\alpha$
\end{document}


Result with pdfTeX:

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./newtxtest2.tex
LaTeX2e <2014/05/01>
Babel <3.9k> and hyphenation patterns for 78 languages loaded.
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/report.cls
Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/size10.clo))
(./newtxtest2.aux)

LaTeX Font Warning: Font shape OMX/ntxex/m/n' undefined
(Font)              using OMX/cmex/m/n' instead on input line 5.

[1{/usr/local/texlive/2014/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./newtxtest2.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

)</usr/local/texlive/2014/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb
></usr/local/texlive/2014/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb>
</usr/local/texlive/2014/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></
usr/local/texlive/2014/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb>
Output written on newtxtest2.pdf (1 page, 37359 bytes).
SyncTeX written on newtxtest2.synctex.gz.
Transcript written on newtxtest2.log.


Same goes for XeLaTeX. Now, in a more complicated situation with a package of mine, I got an error. In this case, I get a warning, and the wrong shape for the integral: I get the Computer Modern one, the default one, if I read that cmex correctly. Indeed, adding

\SetSymbolFont{largesymbols}{bold}{OMX}{ntxex}{b}{n}
\DeclareFontSubstitution{OMX}{ntxex}{m}{n}


produces, with XeLaTeX:

This is XeTeX, Version 3.14159265-2.6-0.99991 (TeX Live 2014) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
(./newtxtest2.tex
LaTeX2e <2014/05/01>
Babel <3.9k> and hyphenation patterns for 78 languages loaded.
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/report.cls
Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/size10.clo))
(./newtxtest2.aux)
No file OMXntxex.fd.

./newtxtest2.tex:6: LaTeX Error: This NFSS system isn't set up properly.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.6 \begin{document}


Yet the code is copied literally from the package, so what is going on here? Why is that .fd not found? I know where it is, but TeX seems not to, and if I put it where TeX can find it, it starts doing strange things and calling metafont and ending up with no .tfm:

[…]
kpathsea: Running mktextfm bickham-r
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input bickham-r
This is METAFONT, Version 2.7182818 (TeX Live 2014) (preloaded base=mf)

kpathsea: Running mktexmf bickham-r

! I can't find file bickham-r'.
<*> ...jfour; mag:=1; nonstopmode; input bickham-r

Please type another input file name
! Emergency stop.


Why is this coming about? How do I get the desired shape for the integral symbol without loading newtxmath directly?

• There is no such file. Hence, it cannot be found. Which package did you copy those lines from? Certainly not newtxmath.sty. – cfr Apr 19 '15 at 19:26
• There is no OMX encoded font ntxex. The newtxmath package uses a different encoding for the math extension font called LMX. – egreg Apr 19 '15 at 19:26
• Note that the equivalent of the .fd file for the LMX encoding and the setup of that encoding are part of newtxmath.sty. So you cannot use those lines on their own substituting LMX either. – cfr Apr 19 '15 at 19:32
• 1) I have found the .fd file with newtxmath.sty, in the same directory I mean; 2) newtxmath.sty has precisely that line on my HD; 3) Indeed I tried LMX and it didn't work. – MickG Apr 19 '15 at 19:41
• What does this piece of newtxmath.sty say now? – MickG Apr 19 '15 at 19:43

Provided you don't need scaling, at a minimum you need something like this:

\documentclass[a4paper]{report}
\DeclareFontEncoding{LMX}{}{}
\DeclareFontSubstitution{LMX}{ntxexx}{m}{n}
\DeclareFontFamily{LMX}{ntxexx}{}
\DeclareFontShape{LMX}{ntxexx}{m}{n}{<->ntxexx}{}
\DeclareFontShape{LMX}{ntxexx}{b}{n}{<->ntxbexx}{}
\DeclareFontShape{LMX}{ntxexx}{bx}{n}{<->ssub ntxexx/b/n}{}
\DeclareSymbolFont{largesymbols}{LMX}{ntxexx}{m}{n}
\SetSymbolFont{largesymbols}{bold}{LMX}{ntxexx}{b}{n}
\begin{document}
$\forall\exists<>\leq\geq\int\subseteq\supseteq$
$\int abcdefghijklmnopqrstuvwxyz+-=\alpha$
\end{document}


However, if you only want to use a couple of symbols from the font, this is not a good way to do it (because everything which uses largesymbols will now use the newtxmath fonts) and it won't work properly anyway (because LMX is not equivalent to OMX).

So it is better to create a new symbol font and use that just to redefine the symbols you want (as egreg's answer does).

You might, however, also want to use the integral symbols for maths extension A from newtxmath. In that case, you need to set up an additional font, but this configuration can be taken straight from newtxmath.sty since it already defines an additional symbol font.

Putting this together:

\documentclass[a4paper]{report}
\usepackage{mathtools}
\makeatletter
\DeclareFontEncoding{LMX}{}{}
\DeclareFontSubstitution{LMX}{ntxexx}{m}{n}
\DeclareFontFamily{LMX}{ntxexx}{}
\DeclareFontShape{LMX}{ntxexx}{m}{n}{<->ntxexx}{}
\DeclareFontShape{LMX}{ntxexx}{b}{n}{<->ntxbexx}{}
\DeclareFontShape{LMX}{ntxexx}{bx}{n}{<->ssub ntxexx/b/n}{}
\DeclareSymbolFont{largesymbolsTX}{LMX}{ntxexx}{m}{n}
\SetSymbolFont{largesymbolsTX}{bold}{LMX}{ntxexx}{b}{n}
\DeclareMathSymbol{\intop}{\mathop}{largesymbolsTX}{"52}
\def\int{\intop\nolimits}
\DeclareMathSymbol{\ointop}{\mathop}{largesymbolsTX}{"48}
\def\oint{\ointop\nolimits}
\DeclareSymbolFont{largesymbolsTXA}{U}{ntxexa}{m}{n}
\SetSymbolFont{largesymbolsTXA}{bold}{U}{ntxexa}{b}{n}
\DeclareFontSubstitution{U}{ntxexa}{m}{n}
\def\re@DeclareMathSymbol#1#2#3#4{%
\let#1=\undefined
\DeclareMathSymbol{#1}{#2}{#3}{#4}}
\re@DeclareMathSymbol{\oiintop}{\mathop}{largesymbolsTXA}{8}
\def\oiint{\oiintop\ilimits@}
\re@DeclareMathSymbol{\ointctrclockwiseop}{\mathop}{largesymbolsTXA}{10}
\def\ointctrclockwise{\ointctrclockwiseop\ilimits@}
\re@DeclareMathSymbol{\ointclockwiseop}{\mathop}{largesymbolsTXA}{12}
\def\ointclockwise{\ointclockwiseop\ilimits@}
\re@DeclareMathSymbol{\sqintop}{\mathop}{largesymbolsTXA}{14}
\def\sqint{\sqintop\ilimits@}
\re@DeclareMathSymbol{\iintop}{\mathop}{largesymbolsTXA}{33}
\def\iint{\iintop\ilimits@}
\re@DeclareMathSymbol{\iiintop}{\mathop}{largesymbolsTXA}{35}
\def\iiint{\iiintop\ilimits@}
\re@DeclareMathSymbol{\iiiintop}{\mathop}{largesymbolsTXA}{37}
\def\iiiint{\iiiintop\ilimits@}
\re@DeclareMathSymbol{\idotsintop}{\mathop}{largesymbolsTXA}{39}
\def\idotsint{\idotsintop\ilimits@}
\re@DeclareMathSymbol{\oiiintop}{\mathop}{largesymbolsTXA}{41}
\def\oiiint{\oiiintop\ilimits@}
\re@DeclareMathSymbol{\varointctrclockwiseop}{\mathop}{largesymbolsTXA}{43}
\def\varointctrclockwise{\varointctrclockwiseop\ilimits@}
\re@DeclareMathSymbol{\varointclockwiseop}{\mathop}{largesymbolsTXA}{45}
\def\varointclockwise{\varointclockwiseop\ilimits@}
\re@DeclareMathSymbol{\fintop}{\mathop}{largesymbolsTXA}{62}
\def\fint{\fintop\ilimits@}
\re@DeclareMathSymbol{\oiintctrclockwiseop}{\mathop}{largesymbolsTXA}{64}
\def\oiintctrclockwise{\oiintctrclockwiseop\ilimits@}
\re@DeclareMathSymbol{\varoiintclockwiseop}{\mathop}{largesymbolsTXA}{66}
\def\varoiintclockwise{\varoiintclockwiseop\ilimits@}
\re@DeclareMathSymbol{\oiiintctrclockwiseop}{\mathop}{largesymbolsTXA}{68}
\def\oiiintctrclockwise{\oiiintctrclockwiseop\ilimits@}
\re@DeclareMathSymbol{\varoiiintclockwiseop}{\mathop}{largesymbolsTXA}{70}
\def\varoiiintclockwise{\varoiiintclockwiseop\ilimits@}
\re@DeclareMathSymbol{\oiintclockwiseop}{\mathop}{largesymbolsTXA}{72}
\def\oiintclockwise{\oiintclockwiseop\ilimits@}
\re@DeclareMathSymbol{\varoiintctrclockwiseop}{\mathop}{largesymbolsTXA}{74}
\def\varoiintctrclockwise{\varoiintctrclockwiseop\ilimits@}
\re@DeclareMathSymbol{\oiiintclockwiseop}{\mathop}{largesymbolsTXA}{76}
\def\oiiintclockwise{\oiiintclockwiseop\ilimits@}
\re@DeclareMathSymbol{\varoiiintctrclockwiseop}{\mathop}{largesymbolsTXA}{78}
\def\varoiiintctrclockwise{\varoiiintctrclockwiseop\ilimits@}
\re@DeclareMathSymbol{\sqiintop}{\mathop}{largesymbolsTXA}{80}
\def\sqiint{\sqiintop\ilimits@}
\re@DeclareMathSymbol{\sqiiintop}{\mathop}{largesymbolsTXA}{82}
\def\sqiiint{\sqiiintop\ilimits@}
\makeatother
\begin{document}
$\forall\exists<>\leq\geq\int\subseteq\supseteq$
$\int abcdefghijklmnopqrstuvwxyz+-=\alpha$
$\int \oint \iint \iiint \iiiint \idotsint \idotsint$
\end{document}


I don't know why you'd want to use mathptmx and substitute symbols from newtxmath instead of directly using the latter. The fonts provided by mathptmx are in large parts ugly, because they are built from various sources; in particular the Greek letters are nasty.

However, here's how you can do for the integral. I'll leave to you other symbols. Note that newtx uses a different font encoding for its math extension font, because it accommodates much more characters than the standard OMX encoding. Also, defining the largesymbols math group is surely not recommended, because this must be accompanied by redefinitions of several symbols (or at least it requires a thorough check of the differences between the OMX and LMX encodings).

\documentclass{article}
\usepackage{mathptmx}

\DeclareFontEncoding{LMX}{}{}
\DeclareFontSubstitution{LMX}{ntxexx}{m}{n}
\DeclareFontFamily{LMX}{ntxexx}{}
\DeclareFontShape{LMX}{ntxexx}{m}{n}{<-> ntxexx}{}
\DeclareFontShape{LMX}{ntxexx}{b}{n}{<-> ntxbexx}{}
\DeclareFontShape{LMX}{ntxexx}{bx}{n}{<->ssub ntxexx/b/n}{}
\DeclareSymbolFont{largesymbolsNT}{LMX}{ntxexx}{m}{n}

\DeclareMathSymbol{\intop}{\mathop}{largesymbolsNT}{"52}

\begin{document}

$\int_a^b f(x)\,dx$

\end{document}


• The problem is that the OP has an extremely old version of the package for whatever reason and I don't think it at all safe to think that this will work. (This is why I deleted my answer although I realise that yours shows how to get just the integral whereas mine just tried to correct the MWE in the question.) – cfr Apr 19 '15 at 20:25
• In particular, the OP's version of newtxmath does use OMX for largesymbols... – cfr Apr 19 '15 at 20:27
• @cfr I don't support old versions of packages, in general. In this particular case, trying to go back to older versions is hopeless and it would be wasted time as soon as the package gets updated in the OP's system. Of course the best is simply to say \usepackage{newtxtext,newtxmath} and forget about mathptmx. – egreg Apr 19 '15 at 20:27
• Fair enough. But then 'update the package' is a required part of the solution since your code depends on that. [Actually, it turns out the OP also has a more up-to-date distribution. Although it still isn't the current version of this package.] – cfr Apr 19 '15 at 20:48
• @egreg I'm actually using neither, but pulling the best from both. There are some things I like better in mathptmx, which I have been using and liking for over a year now, ever since before my \mathchoice question. I guess I'm mixing for two main reasons: 1) newtx seems to be a "modern" replacement for an obsolete font package mathptmx; 2) I agree with you the greek from mathptmx` is problematic, but not because of the glyphs, but rather because of the ill-scaling. – MickG Apr 20 '15 at 13:55