3

I'm using XeLaTeX on Linux. I know that Latin Modern Roman is the default font of XeLaTeX, however if in my preamble I write

\setmainfont{Latin Modern Roman}
\setsansfont{Latin Modern Sans}
\setmonofont{Latin Modern Mono}
\setmathfont{Latin Modern Math}

I get errors like

The font "Latin Modern Roman" cannot be found \setmainfont{Latin Modern Roman}.

I really do not understand what is the name of this defaul character. Then, I use unicode-math package: my preamble is

\documentclass{article}
\usepackage{fontspec}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
%\setmainfont{Latin Modern Roman}
%\setsansfont{Latin Modern Sans}
%\setmonofont{Latin Modern Mono}
% \setmathfont{Latin Modern Math}
\usepackage{unicode-math} 

I don't like default \mathbb and \mathcal font of XeLaTeX. I noticed that, if I remove unicode-math I get the correct symbols. How to continue using unicode-math and having AMS font fot \mathbb and \mathcal?

  • Please provide a complete example we can compile. Note that fontspec enables Latin Modern for text by default. There is no need to set the serif. sans and mono as you do. I imagine that these fonts may not be installed for your system generally, which is necessary in order to use their names in this way with fontspec. – cfr May 3 '16 at 22:55
3

I don't know why Latin Modern Roman is not recognized, perhaps it's not correctly installed as a system font.

For getting the “traditional” calligraphic and blackboard fonts you can use the standard setup.

\documentclass{article}
\usepackage{amsmath} % should go before unicode-math
%\usepackage{fontspec} % already loaded by unicode-math
\usepackage{unicode-math}
\usepackage{amsthm}

\setmainfont{Latin Modern Roman}
\setsansfont{Latin Modern Sans}
\setmonofont{Latin Modern Mono}
\setmathfont{Latin Modern Math}

\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}
\let\mathbb\relax % remove the definition by unicode-math
\DeclareMathAlphabet{\mathbb}{U}{msb}{m}{n}

\begin{document}

abc \textsf{def} \texttt{ghi}

$a+b\in\mathbb{R}\setminus\mathcal{ABC}$

\end{document}

enter image description here

  • It seems that it accets only file name (like *.otf) but not the name of the character. How can I proceed? – MaPo May 3 '16 at 23:13
  • @MaPo Actually Latin Modern is chosen by default, so you can just leave all \set...font instructions off. – egreg May 3 '16 at 23:16
  • Why if I use $\bar{\mathcal{Q}}$ I get an error message. Is there a way to get the correct result? – MaPo Jun 7 '17 at 16:22
  • @MaPo Sorry, only an ugly workaround. – egreg Jun 7 '17 at 17:22
  • Ok, so there is no way to use exactly the same fonts? – MaPo Jun 7 '17 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.