2

I want to write arabic document which contain mathematics using context, I would like to use Latin Modern font for mathematics (which I use when writing my documents with xelatex).

My question is how to combine arabic font for text with Latin Modern font for mathematic

xelatex MWE

\documentclass[a4paper]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{polyglossia}

\setdefaultlanguage[calendar=gregorian]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}

\parindent 0pt
\begin{document}

كلمة كلمة

$x+y$

\end{document}

Context (Not WE)

\setuppapersize[A4]
\mainlanguage[arabic]
\setupdirections[bidi=global]
\setupalign[r2l]  

\definefontfeature
  [arabic]
  [mode=node,language=dflt,script=arab,
    init=yes,medi=yes,fina=yes,isol=yes,
    liga=yes,dlig=yes,rlig=yes,tlig=yes,
    calt=yes,trep=yes,clig=yes,
    mark=yes,mkmk=yes,kern=yes,curs=yes]


\starttypescript [serif] [arabic]
  \definefontsynonym [Arabic-Regular] [name:Amiri] [features=arabic]
  \definefontsynonym [Arabic-Bold] [name:Amiri] [features=arabic]
\stoptypescript

\starttypescript [serif] [arabic] [name]
 \usetypescript[serif][fallback]
 \definefontsynonym [Serif]     [Arabic-Regular] [features=arabic]
 \definefontsynonym [SerifBold] [Arabic-Bold]    [features=arabic]
\stoptypescript

\starttypescript [Arabic]
 \definetypeface [Arabic] [rm] [serif] [arabic] [default]
\stoptypescript 

\setuplayout[
  grid=min,
  backspace=25mm, width=160mm,
  topspace=15mm, height=265mm,
  header=10mm,footer=10mm,
  headerdistance=2mm
  ]

\setupbodyfont[Arabic,18pt]
\setupinterlinespace[line=30pt]

\starttext

كلمة كلمة 

$x+y$

\stoptext
3

You need to define math typeface as well. The following should work (Not tested because I don't have the arabic font):

\starttypescript [Arabic]
 \definetypeface [Arabic] [rm] [serif] [arabic] [default]
 \definetypeface [Arabic] [mm] [math]  [modern] [default]
\stoptypescript 

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.