4

I need to change the font from lmodern to Times belonging to newtx package.

Started with this MWE

\documentclass{minimal}

\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\input{glyphtounicode}
\pdfgentounicode=1

\usepackage[centertags,intlimits,namelimits,sumlimits]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}


\begin{document}

\(f \colon \mathbb{R} \to \mathbb{R}\) such that
\begin{align*}
  f(25) &= f(5^2) \\
  &= f(3^2 + 4^2) \\
  &= f(3) + f(4)
\end{align*}

\end{document}

...and got to this MWE

\documentclass{minimal}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\input{glyphtounicode}
\pdfgentounicode=1

\usepackage{newtxtext}
\usepackage[centertags,intlimits,namelimits,sumlimits]{amsmath}
\usepackage{newtxmath}
\usepackage{amsfonts}
\usepackage{amssymb}


\begin{document}

\(f \colon \mathbb{R} \to \mathbb{R}\) such that
\begin{align*}
  f(25) &= f(5^2) \\
  &= f(3^2 + 4^2) \\
  &= f(3) + f(4)
\end{align*}

\end{document}

The latter does not compile successfully (but it did last year on March 18, with the following versions: newtxtext 2018/03/27 v1.531, newtxmath 2018/05/15 v1.553, amsmath 2018/12/01 v2.17b AMS math features, amsfonts 2013/01/14 v3.01 Basic AMSFonts support, amssymb 2013/01/14 v3.01 AMS font symbols):

amssymb.sty:261: LaTeX Error: Command `\Bbbk' already defined.

Putting a comment on \usepackage{amssymb} resolves the issue, but there are few remarks on using newtxtext and newtxmath along with AMS stuff in newtx manual which I probably misinterpret.

  1. In general, how can I shift to newtx still using features that I used to have with lmodern?
  2. Is there a better way of setting amsmath options? Note the somewhat weird order of newtxtext, amsmath and newtxmath.

Regards

6
  • 4
    Never use minimal for tests, unless you're testing package loading options. Not for documents to be typeset.
    – egreg
    Feb 1, 2020 at 13:37
  • OK, thank you for the advice. It did not work for Book as well.
    – ivankokan
    Feb 1, 2020 at 13:42
  • 2
    Things compile fine if you load newtxmath after rather than before amssymb. But then, as @egreg has pointed out in his answer, you needn't load amssymb to begin with, since all the symbols defined by amssymb are also defined by newtxmath.
    – Mico
    Feb 1, 2020 at 13:46
  • You can also remove lmodern if loading newtxtext (as the answers do).
    – Davislor
    Feb 2, 2020 at 8:49
  • If you can use a modern TeX engine, you could also load unicode-math and set the math font to TeX Gyre Termes Math, a clone of newtx.
    – Davislor
    Feb 2, 2020 at 8:49

2 Answers 2

8

You need neither amsfonts nor amssymb when you load newtxmath, that covers everything the two packages do.

Since newtxmath loads amsmath; if you want to pass options to amsmath, load it earlier.

\documentclass{article}

\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc} % unnecessary for releases 2018 and later of LaTeX 

\input{glyphtounicode}
\pdfgentounicode=1

\usepackage[centertags,intlimits,namelimits,sumlimits]{amsmath}
\usepackage{newtxtext,newtxmath}


\begin{document}

\(\lessapprox\)

\(f \colon \mathbb{R} \to \mathbb{R}\) such that
\begin{align*}
  f(25) &= f(5^2) \\
  &= f(3^2 + 4^2) \\
  &= f(3) + f(4)
\end{align*}

\end{document}
2
  • Any special reason behind putting \lessapprox in the example?
    – ivankokan
    Feb 1, 2020 at 13:48
  • 1
    @ivankokan I chose a lesser used symbol of amssymb at random.
    – egreg
    Feb 1, 2020 at 13:48
2
\documentclass{article}

\usepackage[T1]{fontenc}

\input{glyphtounicode}
\pdfgentounicode=1

\usepackage{newtxtext}
\usepackage[centertags,intlimits,namelimits,sumlimits]{mathtools}
\usepackage{amssymb}
\usepackage{newtxmath}

\begin{document}

\(f \colon \mathbb{R} \to \mathbb{R}\) such that
\begin{align*}
  f(25) &= f(5^2) \\
  &= f(3^2 + 4^2) \\
  &= f(3) + f(4)
\end{align*}

\end{document}

Compiles fine for me.

Note that amsfonts is already included in amssymb (so you don't need to load it twice). And using mathtools instead of amsmath is not mandatory, but it improves some aspects of amsmath. And except if you're using an older version of LaTeX or your file isn't UTF-8 encoded, [utf8]{inputenc} can be omitted as it has become standard in 2018 .

3
  • I am aware of utf8 being the default, it is still there for other not-so-Unicode-friendly co-editors. :) I have up-to-date MiKTeX installed, let me check versions later when I get home. Do you have the latest? (My second MWE used to work last year but now it does not.)
    – ivankokan
    Feb 1, 2020 at 13:33
  • Ah ok, just checking! :) I ran it on pdfTeX: Version 3.14159265-2.6-1.40.20, MiKTeX: 2.9.7250 64-bit.
    – TivV
    Feb 1, 2020 at 13:36
  • I am also aware of mathtools. Here I prepared MWEs, in full setup I load that later in the preamble.
    – ivankokan
    Feb 1, 2020 at 13:38

You must log in to answer this question.

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