1

I am using xelatex to typset mathematics documents in devanagari. I have problem with \mathbf. I am using velthuis font mapping. In \mathbf, I am getting devanagari characters. But, usual math font is ok. Here is a MWE.

  \documentclass{article} 
  \usepackage{amssymb}
  \usepackage{fontspec}
  \setmainfont[Script=Devanagari,Mapping=velthuis]{Annapurna SIL}
  \newfontfamily\eng{Times New Roman}
  \begin{document}
  yah ek
  udaaharan hai|| 
  {\eng This is a MWE.}     $\mathbf{i}$, $i$
  \end{document}
1

I experience no problems if I (a) load unicode-math instead of fontspec and (b) use \symbf instead of \mathbf.

enter image description here

% !TEX TS-program = xelatex
\documentclass{article} 
\usepackage{amssymb}
\usepackage{unicode-math}
\defaultfontfeatures{Path=/Users/mico/Library/Fonts/} % change this as needed
\setmainfont{AnnapurnaSIL-Regular.ttf}%
   [Script=Devanagari,Mapping=velthuis,
    BoldFont=AnnapurnaSIL-Bold.ttf]
\setmathfont{STIX2Math.otf} % or some other Times-compatible math font
   [Scale=MatchUppercase]
\newfontfamily\eng{Times New Roman.ttf}%
   [Path=/Library/Fonts/, % change this as needed
    Scale=MatchUppercase,
    BoldFont=Times New Roman Bold.ttf,
    ItalicFont=Times New Roman Italic.ttf,
    BoldItalicFont=Times New Roman Bold Italic.ttf]

\begin{document}
yah ek
udaaharan hai|| 

\textbf{yah ek
udaaharan hai|| }

{\eng This \textit{is} \textbf{an} \textbf{\textit{MWE.}}} 

$i$, $\symbf{i}$
\end{document}
|improve this answer|||||
  • 1
    Aside: I use MacTeX2019, with all the latest updates installed. Externally acquired fonts, such as Annapurna SIL and Stix Two Math, are stored in /Users/mico/Library/Fonts in my system; they will (of course!) be placed in other locations on other systems. – Mico Jan 2 at 6:40
1

Using unicode-math and \symbf as suggested by Mico is imho the right and best solution as you will get the correct unicode chars.

But to explain the concrete problem: fontspec by default maps the main text font to \mathrm, but as your main font uses a mapping you get the wrong output.

You could load fontspec with the no-math option, then it will use the default Latin Modern fonts for the \mathXX commands instead. Or you could reset \mathrm to whatever you prefer:

\documentclass{article}
  \usepackage{amssymb}
  \usepackage{fontspec}
  \setmainfont[Script=Devanagari,Mapping=velthuis]{Annapurna SIL}
  \setmathrm{Annapurna SIL}
  \newfontfamily\eng{Times New Roman}
  \begin{document}
  yah ek
  udaaharan hai||
  {\eng This is a MWE.}     $\mathbf{i}$, $i$
  \end{document}

enter image description here

|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.