4

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}

I appreciate your help.

1

1 Answer 1

6

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}

Result

5
  • 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.
    – AboAmmar
    Sep 12, 2014 at 21:10
  • 1
    @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.
    – AboAmmar
    Sep 12, 2014 at 22:25
  • Do you know where I can look up the code for any other simbol? for instance where 50 is the code for \sum. Nov 13, 2023 at 14:49
  • @N.Pullbacki In general, it depends on the used fonts and font packages. Here, the CM symbols can be taken from the definitions in tds:tex/latex/base/fontmath.ltx, e.g.: \DeclareMathSymbol{\sum}{\mathop}{largesymbols}{"50}. Nov 17, 2023 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .