3

This question emphases the issue for correct presentation of mixed english-rtl (and, in particular, Hebrew) in different Windows editors. In order to illustrate the issue, this is latex compilation result:

enter image description here

This is the presentation of the text in TexStudio, TeXworks and Notepad++ (the three ones I have recently checked).

enter image description here

This is the result of starting new line.

enter image description here

The preferable single-line text presentation (and the input) is:

.בדיקה $x^2$ שלום

By now, the only editor (not useful for Latex) I have verified to correctly support it is MS Word.

  • You've not said exactly what the input is here, particularly in terms of RTL/LTR markers. I'm surprised you are getting the two $ next to each other without some invisible markup. – Joseph Wright May 29 at 6:37
  • I have edited the question. Yes, editor presents the two $ next to each other without any invisible markup. – Moshe Gueta May 29 at 7:46
  • you could try winedt, it has bidi support. But I have no idea if it works as expected (I do find direction changes rather confusing and never really understood how the input and output should relate). – Ulrike Fischer May 29 at 8:29
4

I don't think it's so clear that what you have seen is incorrect, even though certainly not ideal when working on a LaTeX file.

I'm giving examples of Emacs (available on "all" operating systems, certainly on MS Windows) and how you there can change the behaviour.

(BTW, I wonder if the input you give really has turned out correct here, because there is a period first (!). I've used that as it appears when cut-and-pasting from the question, in spite of my doubts.)

When I cut and paste the part "The preferable single-line text ..." from your question into Emacs it is shown as

enter image description here

with the same dollars-shown-next-to-each-other as you had observered. We know that $x^2$ here is one unit, but I don't think the Unicode Bidirectional Algorithm (UBA) (which for example Emacs implements) is supposed to see that.

The "$" sign has the bidi status "European number separator" which is a "weak" type. It will be seen by conforming programs when parsing the text for numbers. So the text seems to have (normal hebrew text) + (space) + (a number) + (normal left-to-right text) + (a number) + (space) + (normal hebrew text). I haven't followed all steps of the algorithm to their conclusion, but I think it's correct that only the "number" that follows immediately after the obvious left-to-right text also is in that left-to-right part of this rtl-text.

You are better off using \( \) instead of $ $ in LaTeX anyway and that will not look as strange. For me in Emacs

enter image description here

There is nothing inherently ltr about the parens so \( here is written right-to-left with a mirrored "(". Only the inside, x^2, is in ltr-mode. Having "\" to the right of the command would be normal, right, as in this where another command is added:

enter image description here

Normally the directionality of each paragraph is determined by how it starts. That can give strange results in a Hebrew LaTeX file where some lines start with (Hebrew) text and some start with (ltr) commands. So if \emph{} had been used for the first word instead that would change everything!

That can be fixed by inserting bidi control characters in the beginning of paragraphs to explicitly set how they should be. In Emacs you could also tell once and for all which directionality should be for the file by setting bidi-paragraph-direction. So I end with showing one short complete document as Emacs shows it without setting that variable and when setting it explicitly to show this text ltr or rtl.

enter image description here enter image description here enter image description here

0

The support for bi-directionality in most editors is far from good. When it comes to editing Hebrew in LaTeX I usually prefers writing in LyX.

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.