1

I'm writing a Hebrew (RTL) document with equations and I compile it with xelatex. The equation numbers are wrong and I have found that placing \LTR tag before the equation fix this. I have created an environment that with it but something is amiss. When I try to compile this for example:

\documentclass[11pt]{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{xltxtra} 
\usepackage{bidi} 
\setmainfont{Arial} 
\tolerance=1000
\providecommand{\alert}[1]{\textbf{#1}}
\newenvironment{ltreq}[1]{
  \LTR
  \begin{equation}
    {1}}
  {\end{equation}
  \RTL}

\begin{document}
\RTL

\begin{ltreq}
\left . \frac{\partial f}{\partial y} \eta \right |_{x_1}^{x_2} -\int_{x_1}^{x_2} \frac{\partial f}{\partial y'} \eta dx
\end{ltreq}
\RTL

\end{document}

I get this error:

l.22 ...frac{\partial f}{\partial y} \eta \right |
                                                  _{x_1}^{x_2} -\int_{x_1}^{...

I guess that my approach was to naive there. How can I achieve this?

1
  • 1
    Side note: you should use \right\rvert instead of \right|.
    – jub0bs
    Apr 3, 2013 at 13:28

1 Answer 1

2

You specified that the ltreq environment has one argument, so it is swallowing the \left in the beginning of the equation. If you remove the [1] from the definition it works:

\documentclass[11pt]{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{xltxtra} 
\usepackage{bidi} 
\setmainfont{Arial} 
\tolerance=1000
\providecommand{\alert}[1]{\textbf{#1}}
\newenvironment{ltreq}{
  \LTR
  \begin{equation}}
  {\end{equation}
  \RTL}

\begin{document}
\RTL

\begin{ltreq}
\left . \frac{\partial f}{\partial y} \eta \right |_{x_1}^{x_2} -\int_{x_1}^{x_2} \frac{\partial f}{\partial y'} \eta dx
\end{ltreq}
\RTL

\end{document}
3
  • Thanks. As a followup question. If I try to pull the same trick with align environment. Latex fail because \begin{align} on input line 304 ended by \end{ltral} Do you have any clue about this?
    – Yotam
    Apr 3, 2013 at 13:34
  • @Yotam No, I don't :) You should very much post that as a separate question though.
    – marczellm
    Apr 3, 2013 at 14:33
  • \LTR is group local AFAIK, so you could just do \newenvironment{ltreq}{\begingroup\LTR\begin{equation}}{\end{equation}\endgroup}
    – kahen
    Apr 3, 2013 at 16:47

You must log in to answer this question.

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