7

I recently installed a MacTex version and I faced a problem with the direction of parentheses both in the enumeration and the text reference using \eqref. I use XeLaTeX to compile the tex files. Since in my tex file I have right-to-left content, I have to use the bidi package.

Example:

Precision is computed as in equation )3.3(.

enter image description here

Here is the code:

\documentclass[oneside, a4paper]{report}

\usepackage{amsmath}

\usepackage{fontspec}\newfontfamily\Farsifont[Script=Arabic]{XB Niloofar}
\usepackage{fontspec}\newfontfamily\Parsifont[Script=Arabic]{XB Kayhan}
\usepackage{bidi}
\newcommand{\ARL}[1]{\RL{\Farsifont #1}}
\newcommand{\PRL}[1]{\RL{\Parsifont #1}}

\begin{document}

Precision is computed as in equation \eqref{eq:precision}.

\begin{equation}
\label{eq:precision}
P = \frac{Number~of~Correct~Constituents}{Total~Number~of~Constituents~in~Parser~Output}
\end{equation}

\end{document}

How can the parentheses be reordered in the correct format?

9
  • 1
    Please provide an executable MWE.
    – user31034
    Commented Jan 10, 2014 at 14:24
  • 2
    Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – jub0bs
    Commented Jan 10, 2014 at 14:30
  • 2
    What a nice question! I'm curious to see the reason and the solution. +1
    – Sigur
    Commented Jan 10, 2014 at 14:34
  • 1
    To put them in the correct format (which is the default) you need to not do whatever you did to put them in that format, so you need to show the code that produces that. Is the main text of your document Right to Left by any chance? Commented Jan 10, 2014 at 14:41
  • 2
    Related: tex.stackexchange.com/questions/84293/…
    – jub0bs
    Commented Jan 10, 2014 at 15:02

1 Answer 1

1

The main problem here is essentially the same as that in amsmath - bidi - siunitx possible bug? and Joseph Wrights solution there works here too. Additionally, you setting of the text in mathematics, in particular with ~, is not correct, producing error messages. Normally I would write such text chunks in \text, but in this situation you might choose the solution below with \mathit and space written as \:

Sample output

\documentclass[oneside, a4paper]{report}

\usepackage{amsmath}

\usepackage{fontspec}
\usepackage{bidi}
\newcommand{\ARL}[1]{\RL{\Farsifont #1}}
\newcommand{\PRL}[1]{\RL{\Parsifont #1}}

\csname @Latintrue\endcsname

\begin{document}

Precision is computed as in equation \eqref{eq:precision}.

\begin{equation}
\label{eq:precision}
P = \frac{\mathit{Number\ of\ Correct\ Constituents}}{\mathit{Total\
Number\ of\ Constituents\ in\ Parser\ Output}}
\end{equation}

\end{document}
2
  • If you used \textit instead of \mathit in the two parts of the fraction, you could dispense with the explicit \ (space) directives...
    – Mico
    Commented Jun 17, 2014 at 18:56
  • That is essentially what I meant by saying "normally I would write such chunks in \text". However, the \mathit version may be more appropriate inside some right-to-left material, where mathematics still has to be left-to-right. We don't really have enough context from the poster. Commented Jun 17, 2014 at 19:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .