[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there a way to force the directionality of a line of text in the
From: |
Joost Kremers |
Subject: |
Re: Is there a way to force the directionality of a line of text in the GUI? |
Date: |
Tue, 15 Nov 2022 12:13:10 +0100 |
User-agent: |
mu4e 1.8.3; emacs 28.1.91 |
On Mon, Nov 14 2022, Evan Aad wrote:
> When composing a bilingual document that combines a right-to-left
> language, such as Hebrew, with a left-to-right language, such as
> English, is there a way to force the left- or right alignment of a
> line of text in the Emacs GUI when the text in that line contains no
> letters of either alphabet.
>
> For example, when writing a mathematical text in Hebrew, intended to
> be typeset by the TeX system, the following display-mode equation may
> occur:
> $$
> x+y=z
> $$
>
> In this case the Emacs GUI would align the initial $$ along the
> buffer's right margin, whereas the next two lines would be aligned
> along the left margin. This causes a disruption of the logical
> cohesiveness of the LaTeX code. Is there a way that I could indicate
> to the Emacs GUI to align the initial $$ along the left margin?
See (info "(emacs) Bidirectional Editing") for this.
If the text were all Hebrew, you could set the variable
`bidi-paragraph-direction` to `right-to-left` and have all text start at the
right margin. Otherwise, I think all you can do is insert the special Unicode
character LEFT-TO-RIGHT MARK at the beginning of the relevant line. I don't know
what your TeX system will do with that character, though.
The character $ has 'weak directionality', meaning that (as stated in the Elisp
manual) it "take[s] on the directionality of surrounding text".[1] It seems that
"surrounding text" in this case means "preceding text", which probably makes
sense in most cases, but not necessarily in your particular case, where $
follows a blank line (assuming you have blank lines surrounding $$...$$). Though
perhaps someone more knowledgeable than me can shed some light on this.
HTH
Joost
Footnotes:
[1] (info "(elisp) Bidirectional Display")
--
Joost Kremers
Life has its moments