1

I am writing a code in overleaf with the XeLaTeX compiler. this is the code:

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{graphicx} % Required for inserting images
\usepackage{extarrows}
\usepackage{unicode-math}
\usepackage{amsmath, amsfonts, amssymb}
\usepackage{tikz}
\usepackage{bidi}
\setmainfont{Times New Roman}
\begin{document}
\begin{RTL}
$\mathbb{R}$
\end{RTL}
\end{document}

I know that I "should" write the minimal version of the code, but I need to use all of this packages for my work, and so I want a solution that will not clash with the other packages.
When I compiler the code, I get:
enter image description here

But I want to get the regular:
enter image description here

Thank you all for your help.

4
  • ! LaTeX Error: Command \eth' already defined.` Commented Feb 8 at 16:59
  • The R you get come from Latin Modern Math. But you load Times as text font. Maybe you want to use TeXGyre Termes Math or some other math font that goes well with the Times font for text? If you want to stay with something that is similar to Latin Modern Math, then maybe New Computer Modern Math could be something for you.
    – mickep
    Commented Feb 8 at 16:59
  • @mickep The thing is I already used all those packages multiple times and nothing like this ever happend Commented Feb 8 at 17:01
  • 1
    don't use any of \usepackage{amsmath, amsfonts, amssymb} with unicode-math (unicode-math loads amsmath and the others are not compatible with it Commented Feb 8 at 17:01

2 Answers 2

0

enter image description here

The R you show is not a problem it is the design from latin modern math which is the default font once you select unicode-math, here I use Stix Two which is far more compatible with a Times Roman text font.

I removed the ams packages as they are not compatible with unicode-math and give errors.

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{graphicx} % Required for inserting images
\usepackage{extarrows}
\usepackage{unicode-math}
%\usepackage{amsmath, amsfonts, amssymb}
\usepackage{tikz}
\usepackage{bidi}
\setmainfont{Times New Roman}
\setmathfont{STIX Two Math}
\begin{document}
\showoutput
\begin{RTL}
$\mathbb{R}$
\end{RTL}
\end{document}

Another Times compatible math font that has black board bold perhaps closer to your request is TeX Gyre Termes which produces

enter image description here

from

\setmathfont{TeX Gyre Termes Math}
2
  • But is the unicode-math package include all of the amsmath, amsfonts and amssymb stuff? Commented Feb 8 at 17:07
  • @ArielFishbein it literally includes amsmath.sty and amsfonts/amssymb make no sense with it as they are loading 8 bit legacy tex math fonts and the whole point of unicode-math is to use opentype. It already covers a larger set of characters with mostly compatible command names. Commented Feb 8 at 17:09
0

That's not the only problem: if you try

$\mathbb{R}+x+y+z$ \textit{xyz} $x$\textit{x}

you not only get a blackboard bold letter you don't like, but also clashing fonts between text and math:

enter image description here

In order to get a math font compatible with Times New Roman you could choose STIX Two Math, but, again the blackboard bold is probably not of your liking. You can replace the blackboard bold block, though, with another font that has the glyphs you like.

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{graphicx} % Required for inserting images
\usepackage{extarrows}
\usepackage{unicode-math}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{bidi}

\setmainfont{Times New Roman}
\setmathfont{STIX Two Math}[Scale=MatchLowercase]
\setmathfont{TeX Gyre Termes Math}[range=\mathbb,Scale=MatchLowercase]
\setmathfont{STIX Two Math}[Scale=MatchLowercase,range=]

\begin{document}

$\mathbb{R}+x+y+z$ \textit{xyz} $x$\textit{x}

\end{document}

The last instruction with range= is used to reinstate the font parameters of STIX Two Math. You might just use TeX Gyre Termes Math for everything, but it's way less complete than the other font.

enter image description here

Note that amssymb and amsfonts should not be loaded together with unicode-math.

You must log in to answer this question.

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