# Replace a few math symbols in the newtxmath font

I use the \newtxmath as the math font in my document and \newtxtext for the text. This seems to work fine, but I need to replace some math symbols which seem to me not as nice as their default Latin Modern Math counterpart. The symbols I need to replace, e.g., are:

• \int and \sum: they look so high and big,
• \infty: looks too small, and
• \partial and \pi: looks strange too.

I have searched for similar or near question like this one (Replace several letters in math font), but I haven't been very successful in reusing the answer therein in my case.

My MWE is:

\documentclass{scrartcl}
\usepackage{amsmath,amssymb}
\usepackage{newtxtext,newtxmath}
\begin{document}

\noindent
ABCDEFGHIJKLMNOPQRSTUVWXYZ \\
abcdefghijklmnopqrstuvwxyz \\
$abcdefghijklmnopqrstuvwxyz$ \\
$ABCDEFGHIJKLMNOPQRSTUVWXYZ$ \\
$a\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\varkappa\lambda\mu\nu\xi o\pi\varpi\rho\varrho\sigma\varsigma\tau\upsilon\phi\varphi\chi\psi\omega$ \\
$\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega$ \\
$\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$
$\frac{1}{2\pi i}\int_\gamma f(x) = \sum_{k=1}^m n(\gamma;a_k) \cdot \text{Res}(f;a_k).$
$G(\omega)=\int_{-\infty}^{\infty}g(t)e^{-j\omega t} dt$
And this is nonmath text.

\end{document}


The case \int is trivial, because there is an option cmintegrals for package newtxmath. In the other cases, the symbol fonts are overwritten by newtxmath. Therefore the example again defines them with a different name (CM appended):

 \documentclass{scrartcl}
\usepackage{amsmath,amssymb}

\usepackage{newtxtext}
\usepackage[cmintegrals]{newtxmath}

%% \sum
\DeclareSymbolFont{largesymbolsCM}{OMX}{cmex}{m}{n}
\let\txsum\sum
\let\sum\relax
\DeclareMathSymbol{\sum}{\mathop}{largesymbolsCM}{"50}

%% \infty
\DeclareSymbolFont{symbolsCM}{OMS}{cmsy}{m}{n}
\SetSymbolFont{symbolsCM}{bold}{OMS}{cmsy}{b}{n}
\let\txinfty\infty
\DeclareMathSymbol{\infty}{\mathord}{symbolsCM}{"31}

%% \partial, \pi
\DeclareSymbolFont{lettersCM}{OML}{cmm} {m}{it}
\SetSymbolFont{lettersCM}{bold}{OML}{cmm} {b}{it}
\let\txpartial\partial
\DeclareMathSymbol{\partial}{\mathord}{lettersCM}{"40}
\let\txpi\pi
\DeclareMathSymbol{\pi}{\mathord}{lettersCM}{"19}

\begin{document}

\begin{align*}
\text{CM} &= \text{TX} \\
\int \\
\sum &= \txsum \\
\infty &= \txinfty \\
\partial &= \txpartial \\
\pi &= \txpi
\end{align*}

\end{document}


• Works very fine @Heiko Oberdiek, but please I need more clarification about the commands \DeclareSymbolFont{symbolsCM}{OMS}{cmsy}{m}{n} \SetSymbolFont{symbolsCM}{bold}{OMS}{cmsy}{b}{n}. How do I know the parameters and names associated with a specific symbol. Forgive my shallow knowledge in this regard. Sep 12, 2014 at 21:10
• @AboAmmar A starting point is LaTeX's font guide. In this case I have copied the lines from fontmath.ltx (part of the LaTeX kernel) with the a small change of the name (e.g. symbolsCM instead of symbols). Sep 12, 2014 at 21:42
• That helps so much. Thanks @Heiko Oberdiek. Although I read these information before, application is most important. Sep 12, 2014 at 22:25