1

I used this answer to make all the math in my document adhere to Sans-Serif font.

However, whenever I use the Polyglossia package and add another language, I get an error which says:

Package Polyglossia error: The current Latin font Arial(1) does not contain the "Cyrillic" script! Please define \cyrillicfont with \newfontfamily command.

I get this error despite the fact that did define the Cyrillic font (using this answer).

The error can be produced using Greek, Hebrew and Arabic as well.

enter image description here MWE:

%:Preamble
%:Class
\documentclass[]{article}
%:Language
\usepackage{polyglossia}

%Commenting out the following lines produces the error:
%\setdefaultlanguage{russian}
%\setotherlanguage{english}
%\setmainfont[Ligatures=TeX]{Arial}
%\newfontfamily\cyrillicfont{Arial}[Script=Cyrillic]

%:Fonts
\usepackage{fontspec}
\renewcommand\familydefault{\sfdefault} 
%:Math_Font
% Taken from:https://tex.stackexchange.com/a/41501/179187
\DeclareMathVersion{sans}
\SetSymbolFont{operators}{sans}{OT1}{cmbr}{m}{n}
\SetSymbolFont{letters}{sans}{OML}{cmbrm}{m}{it}
\SetSymbolFont{symbols}{sans}{OMS}{cmbrs}{m}{n}
\SetMathAlphabet{\mathit}{sans}{OT1}{cmbr}{m}{sl}
\SetMathAlphabet{\mathbf}{sans}{OT1}{cmbr}{bx}{n}
\SetMathAlphabet{\mathtt}{sans}{OT1}{cmtl}{m}{n}
\SetSymbolFont{largesymbols}{sans}{OMX}{iwona}{m}{n}

\DeclareMathVersion{boldsans}
\SetSymbolFont{operators}{boldsans}{OT1}{cmbr}{b}{n}
\SetSymbolFont{letters}{boldsans}{OML}{cmbrm}{b}{it}
\SetSymbolFont{symbols}{boldsans}{OMS}{cmbrs}{b}{n}
\SetMathAlphabet{\mathit}{boldsans}{OT1}{cmbr}{b}{sl}
\SetMathAlphabet{\mathbf}{boldsans}{OT1}{cmbr}{bx}{n}
\SetMathAlphabet{\mathtt}{boldsans}{OT1}{cmtl}{b}{n}
\SetSymbolFont{largesymbols}{boldsans}{OMX}{iwona}{bx}{n}

\DeclareMathVersion{sans}
\SetSymbolFont{operators}{sans}{OT1}{cmsmf}{m}{n}
\SetSymbolFont{letters}{sans}{OML}{cmssm}{m}{it}
\SetSymbolFont{symbols}{sans}{OMS}{cmsssy}{m}{n}
\SetMathAlphabet{\mathit}{sans}{OT1}{cmssm}{m}{sl}
\SetMathAlphabet{\mathbf}{sans}{OT1}{cmsssy}{bx}{n}
\SetMathAlphabet{\mathtt}{sans}{OT1}{cmssex}{m}{n}
\SetSymbolFont{largesymbols}{sans}{OMX}{cmssex}{m}{n}

\newif\IfInSansMode
\let\oldsf\sffamily
\renewcommand*{\sffamily}{\oldsf\mathversion{sans}\InSansModetrue}
\let\oldbf\bfseries
\renewcommand*{\bfseries}{\oldbf\IfInSansMode\mathversion{boldsans}\else\mathversion{bold}\fi\relax}
\let\oldnorm\normalfont
\renewcommand*{\normalfont}{\oldnorm\InSansModefalse\mathversion{normal}}
\let\oldrm\rmfamily
\renewcommand*{\rmfamily}{\oldrm\InSansModefalse\mathversion{normal}}
%:Start
\begin{document}
R

$R$

$\mathsf{R=r}$
\end{document}
3

You are redefining \familydefault to be equal to \sfdefault. This means that polyglossia is looking for a sans serif cyrillicfont. You can set it up with

 \newfontfamily\cyrillicfontsf{Arial}[Script=Cyrillic]

It would be probably also a good idea to setup \cyrillicfonttt for the typewriter font.

| improve this answer | |

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.