0

Why does loading polyglosssia first cause an option clash with newtxtext as in the following example? And is there a way to avoid the option while still loading polyglossia first? (Loading it after works OK.)

% !TEX TS-program = XeLaTeX    
\documentclass{article}

% This load order --> option clash for \usepackage{newtxtext}: \usepackage{polyglossia} \setdefaultlanguage[variant=american]{english} \setotherlanguages{french,german,polish,russian}

\renewcommand{\rmdefault}{ntxtlf} \usepackage[T1,T2A]{fontenc} \usepackage[vvarbb]{newtxmath} \usepackage[no-math]{fontspec} % only if you want to load other opentype fonts. \usepackage{newtxtext}

% This load order OK: %\usepackage{polyglossia} %\setdefaultlanguage[variant=american]{english} %\setotherlanguages{french,german,polish,russian}

\newfontfamily{\cyrillicfont}{PT Serif}

\usepackage{amsmath} \usepackage[math]{blindtext}

\begin{document}

Their names in Cyrillic are \textrussian{Алекс'{а}ндров}, \textrussian{Т'{и}хонов}, and \textrussian{Урыс'{o}н}.

\blindmathpaper

\end{document}

Related: https://tex.stackexchange.com/a/448589/13492 and https://tex.stackexchange.com/a/210276/13492.

murray
  • 7,944
  • the option clash is not from newtxtext but from fontspec - polyglossia already loads it. Beside this: you shouldn't use newtxtext and fontenc with T1+T2a with xelatex, these are settings for pdflatex. – Ulrike Fischer Nov 19 '21 at 17:05
  • Using newtxtext and fontenc is what the author of newtx recommends to use the newtx fonts with XeLaTeX. – murray Nov 19 '21 at 17:07
  • I see in the docu a recommendation how to use newtxmath with xelatex but nothing about newtxtext. – Ulrike Fischer Nov 19 '21 at 17:11
  • @UlrikeFischer: Correct, the docs show libertine as the text font. The use of newtxtext with XeLaTeX was provided in a private communication by the newtx author. – murray Nov 19 '21 at 17:30
  • if you use \usepackage[T1,T2A]{fontenc} in xelatex then certainly all hyphenation will be wrong as xelatex loads no hyphenation patterns for 8-bit encodings. – David Carlisle Nov 19 '21 at 17:33
  • 1
    but in this case you anyway undo that by loading fontspec (which will re-set the encoding to TU) but can you not simply use TeX Gryre Termes via fontspec rather than the derived newtx 8bit pdftex font family? – David Carlisle Nov 19 '21 at 17:36
  • Yes, I can use TeX Gyre Termes instead. – murray Nov 19 '21 at 17:41

1 Answers1

2

The setup is much simpler. Just remember to redeclare the operators font.

\documentclass{article}

%\usepackage{fontspec} \usepackage{polyglossia} \usepackage{amsmath} \usepackage[vvarbb]{newtxmath}

\setdefaultlanguage[variant=american]{english} \setotherlanguages{french,german,polish,russian}

\setmainfont{Tempora}[ NFSSFamily=tempora, Extension=.otf, UprightFont=-Regular, ItalicFont=-Italic, BoldFont=-Bold, BoldItalicFont=-BoldItalic, ]

\DeclareSymbolFont{operators}{TU}{tempora}{m}{n}

\begin{document}

Their names in Cyrillic are \textrussian{Алекс'{а}ндров}, \textrussian{Т'{и}хонов}, and \textrussian{Урыс'{o}н}.

Some in text formula $a+b=c-\sqrt[3]{2}$ [ \int_{-\infty}^\infty e^{-x^2},dx=\sqrt{\pi} \qquad \sin^2x+\cos^2x=1 ]

\end{document}

The Tempora font is available in TeX Live and is a clone of Times supporting Cyrillic.

enter image description here

egreg
  • 1,121,712
  • How close is Tempora to newtxtext, in comparision with how close TeX Gyre Termes is to newtxtext? – murray Nov 20 '21 at 23:08
  • @murray I see no difference between the three, as far as Latin characters are concerned. – egreg Nov 20 '21 at 23:19
  • The fontspec docs (page 5) say that file tempora.fontspec is read by fontspec whenever tempora is loaded as a font, and that file includes the options Extension = .otf , UprightFont = Tempora-Regular, BoldFont = Tempora-Bold, ItalicFont = Tempora-Italic, BoldItalicFont = Tempora-BoldItalic – murray Nov 21 '21 at 16:39
  • @murray Oh, that's good news! – egreg Nov 21 '21 at 16:43
  • What needs to be changed if, indeed, I want to use TeXGyre Termes as the text font? – murray Nov 21 '21 at 19:40