Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
1  
Side note: you should use \right\rvert instead of \right|. –  Jubobs Apr 3 '13 at 13:28
add comment

1 Answer

up vote 2 down vote accepted

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}
share|improve this answer
    
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 '13 at 13:34
    
@Yotam No, I don't :) You should very much post that as a separate question though. –  marczellm Apr 3 '13 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 '13 at 16:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.