3

I'm trying to wrote a few math formulas, but they go left. The picture will explain: enter image description here

As you can see, the < signs are not in the same line. The code:

צד ראשון: \L{
\begin{eqnarray*}
2(i+1) & \leq & j+2\\
2i+2 & \leq & j+2\\
2i & \leq & j
\end{eqnarray*}
}צד שני:\L{
\begin{eqnarray*}
j+2 & \leq & 3(i+1)\\
j+2 & \leq & 3i+3\\
j & \leq & 3i+1
\end{eqnarray*}

I'm using LyX, anyone know how to fix it? Thanks!

  • 3
    eqnarray only aligns the symbols within the same display, the first one has larger formula on the left hand side. – David Carlisle May 18 '19 at 16:58
  • 4
    Note it is impossible for anyone to run your code to debug any issues as you provide no document, and no definition for \L (also it is better to use amsmath evironment align* rather than eqnarray* – David Carlisle May 18 '19 at 17:00
2

The following works for me in LuaLaTeX:

\documentclass{article}
\usepackage[bidi=basic]{babel}
\usepackage{mathtools}
\usepackage{unicode-math}
\usepackage{libertinus}
% To make the output narrow enough to fit on TeX.SX:
\usepackage[paperwidth=11cm]{geometry}

\babelprovide[main, import=he]{hebrew}

\begin{document}
צד ראשון:
\begin{align*}
2(i+1) & \leq & j+2\\
2i+2 & \leq & j+2\\
2i & \leq & j
\end{align*}

צד שני:
\begin{align*}
j+2 & \leq & 3(i+1)\\
j+2 & \leq & 3i+3\\
j & \leq & 3i+1
\end{align*}
\end{document}

Hebrew sample

Or at least, this aligns the equations to the right as you wanted. I would probably tweak the alignment a bit:

\documentclass{article}
\usepackage[bidi=basic]{babel}
\usepackage{mathtools}
\usepackage{unicode-math}
\usepackage{libertinus}
% To make the output narrow enough to fit on TeX.SX:
\usepackage[paperwidth=11cm]{geometry}

\babelprovide[main, import=he]{hebrew}

\begin{document}
צד ראשון:
\begin{align*}
2(i+1) & \leq j+2\\
2i+2 & \leq j+2\\
2i & \leq j
\end{align*}

צד שני:
\begin{align*}
j+2 & \leq 3(i+1)\\
j+2 & \leq 3i+3\\
j & \leq 3i+1
\end{align*}
\end{document}

Sample 2

Both of these samples use the bidi feature of babel to align the equation blocks correctly for Hebrew, and the align* environment of mathtools. They also load a font family with Unicode support for both Hebrew text and math.

See also this question for another way to flush equations to the right, and this one to align equations in two separate blocks.

You might consider adding the option \usepackage[leqno]{mathtools} if you want equation numbers to the left.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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