Do lmodern ao newtx (com amsmath e outros pacotes AMS)

Do lmodern ao newtx (com amsmath e outros pacotes AMS)

Preciso alterar a fonte lmodernpara Times pertencente ao newtxpacote.

Começou com este 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}

...e cheguei a este 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}

Este último não compila com sucesso (mas o fez no ano passado, em 18 de março, com as seguintes versões: 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.

Colocar um comentário \usepackage{amssymb}resolve o problema, mas há alguns comentários sobre o uso newtxtexte newtxmathjunto com o material do AMS no newtxmanual que provavelmente interpretei mal.

  1. Em geral, como posso continuar newtxusando os recursos que eu costumava usar lmodern?
  2. Existe uma maneira melhor de definir amsmathopções? Observe a ordem um tanto estranha newtxtextde amsmathe newtxmath.

Cumprimentos

Responder1

Você não precisa amsfontsnem amssymbquando carrega newtxmath, isso cobre tudo o que os dois pacotes fazem.

Desde newtxmathcargas amsmath; se você quiser passar opções para amsmath, carregue-o antes.

\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}

Responder2

\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}

Compila bem para mim.

Observe que amsfontsjá está incluído amssymb(então você não precisa carregá-lo duas vezes). E usar mathtoolsem vez de amsmathnão é obrigatório, masMelhoraalguns aspectos de amsmath. E exceto se você estiver usando uma versão mais antiga do LaTeX ou se seu arquivo não estiver codificado em UTF-8, [utf8]{inputenc}pode ser omitido, pois se tornou padrão em 2018.

informação relacionada