3

I'd like to insert an equation in my $LaTeX$ document that looks like the following equation but I fail to make it show the text inside the equation:

enter image description here

and the output I am getting:

enter image description here

I read questions\answers regarding the combination of Persian and English in xepersian and used \lr and latin but it doesn't work. What am I doing wrong?

Here is the MWE:

\documentclass[a4paper,12pt]{report}
\usepackage{titlesec}
\usepackage{xepersian}
\usepackage{./styles/tempfix}
\settextfont[Scale=1.1]{B Nazanin}
\defpersianfont\nastaliq[Scale=2]{IranNastaliq}
\defpersianfont\titr[Scale=1]{B Titr}
\defpersianfont\traffic[Scale=1]{B Traffic}
\deflatinfont\calibri{Calibri}
\begin{document}

\begin{equation}
P_J{:}\quad \min_{x} J(x) \quad \textrm{subject to} \quad y=Dx
%P_J{:}\quad \min_{x} J(x) \quad \lr\textrm{subject to} \quad y=Dx
\end{equation}
\end{document}

There is a similar question which was closed.

Gigili
  • 393

1 Answers1

2

Your Persian font doesn't seem to support Latin character. If I use Scheherazade, it does:

\documentclass[a4paper,12pt]{report}

\usepackage{unicode-math}
\usepackage{xepersian}

\setmainfont{TeX Gyre Termes}
\setmathfont{XITS Math}
\settextfont[Scale=MatchUppercase]{Scheherazade}

\begin{document}

\begin{equation}
P_J{:}\quad \min_{x} J(x) \quad \textrm{subject to} \quad y=Dx
\end{equation}

\end{document}

enter image description here

Alternatively,

\documentclass[a4paper,12pt]{report}
\usepackage{amsmath}
\usepackage{xepersian}

\settextfont[Scale=MatchUppercase]{Scheherazade}

\begin{document}

\begin{equation}
P_J{:}\quad \min_{x} J(x) \quad \textnormal{\lr{subject to}} \quad y=Dx
\end{equation}

\end{document}

enter image description here

egreg
  • 1,121,712
  • Thank you for your answer but I really don't like to change the font. – Gigili Aug 16 '16 at 12:00
  • @Gigili The alternative version doesn't require font changes; I used Scheherazade because that's the font I have. – egreg Aug 16 '16 at 12:38