[Tex/LaTex] how to display text properly inside equation in latex

math-modepdftex

how to display text properly inside equation in latex

 \def\DevnagVersion{2.15}  
 \documentclass[conference]{IEEEtran}  
 \usepackage[lined,ruled,vlined,resetcount]{algorithm2e}  
 \renewcommand{\thealgocf}{}  
 \usepackage{csquotes}  
 \usepackage{wfrac}  
 \usepackage{array}  
 \usepackage{caption}  
 \providecommand{\SetAlgoLined}{\SetLine}  
 \hyphenation{op-tical net-works semi-conduc-tor}  
 \usepackage{filecontents}  
 \usepackage{cite}  
 \usepackage{devanagari}  
 \begin{document}
 \begin{equation}  
    PMI({\dn u(pAd} + {\dn \7{K}f}) \\  
    = Round(LOG((F({\dn u(pAd} + {\dn \7{K}f})/TotalBigrams)/( (F({\dn u(pAd})/TotalUnigrams)*(F({\dn \7{K}f})/TotalUnigrams)))\\  
    = Round(LOG( (1/1298) / (20/1299)*(6/1299))),2)\\  
    = Round(Log(0.000770416/(0.0153964588*0.0046189376)),2)\\  
    = Round(Log(10.8333397535),2)\\  
    = Round(1.0347623636,2)\\  
    = 1.03\\  
    \end{equation}
\end{document

The output it displays is

 PMI(u Ú +)
 = Round(LOG((F (u Ú + )/TotalBigrams)/((F(u Ú)/TotalUnigrams)*(F()/TotalUnigrams)))
 = Round(LOG((1/1298)/(20/1299) ∗ (6/1299))), 2)
 = Round(Log(0.000770416/(0.0153964588∗0.0046189376)), 2)
 = Round(Log(10.8333397535), 2)
 = Round(1.0347623636, 2)
 = 1.03

Best Answer

You have to hide the Devanagari bits in \text:

\def\DevnagVersion{2.15}  
\documentclass[conference]{IEEEtran}
\usepackage{amsmath,mleftright}
\usepackage[lined,ruled,vlined,resetcount]{algorithm2e}
\renewcommand{\thealgocf}{}
\usepackage{csquotes}
%\usepackage{wfrac}
\usepackage{array}
\usepackage{caption}
\providecommand{\SetAlgoLined}{\SetLine}
\hyphenation{op-tical net-works semi-conduc-tor}
\usepackage{filecontents}
\usepackage{cite}
\usepackage{devanagari}

\DeclareMathOperator{\Round}{Round}
\DeclareMathOperator{\Log}{Log}

\begin{document}
\begin{equation}
\begin{aligned}
&\mathrm{PMI}(\text{\dn u(pAd} + \text{\dn \7{K}f}) \\
  &= \Round\mleft(\Log
       \frac{\dfrac{F(\text{\dn u(pAd} + \text{\dn \7{K}f}))}{\mathrm{TotalBigrams}}}
            {\dfrac{F(\text{\dn u(pAd}))}{\mathrm{TotalUnigrams}}*
             \dfrac{F(\text{\dn \7{K}f})}{\mathrm{TotalUnigrams}}}
     \mright)\\
  &= \Round\mleft(\Log
       \frac{\dfrac{1}{\mathstrut 1298}}
            {\dfrac{\mathstrut 20}{1299}*\dfrac{6}{1299}}
     ,2\mright)\\  
  &= \Round\mleft(\Log\frac{0.000770416}{0.0153964588*0.0046189376},2\mright)\\
  &= \Round(\Log(10.8333397535),2)\\
  &= \Round(1.0347623636,2)\\
  &= 1.03
\end{aligned}
\end{equation}

\end{document}

I saved this as jha.dn and ran

rm -f jha.tex && devnag jha.dn > jha.tex && pdflatex jha

getting the following result, which fits in a column

enter image description here

Note: I commented out the wfrac package, that I don't have on my system.

Related Question