unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Is there a way to force the directionality of a line of text in the GUI?
@ 2022-11-14  7:17 Evan Aad
  2022-11-15  9:20 ` Arash Esbati
  2022-11-15 11:13 ` Joost Kremers
  0 siblings, 2 replies; 4+ messages in thread
From: Evan Aad @ 2022-11-14  7:17 UTC (permalink / raw)
  To: help-gnu-emacs

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?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is there a way to force the directionality of a line of text in the GUI?
  2022-11-14  7:17 Is there a way to force the directionality of a line of text in the GUI? Evan Aad
@ 2022-11-15  9:20 ` Arash Esbati
  2022-11-15 11:13 ` Joost Kremers
  1 sibling, 0 replies; 4+ messages in thread
From: Arash Esbati @ 2022-11-15  9:20 UTC (permalink / raw)
  To: Evan Aad; +Cc: help-gnu-emacs

Evan Aad <oddeveneven@gmail.com> writes:

> 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
> $$

This is not related to your question, but if you're using LaTeX and not
plain TeX, don't use $$ for display-math.  Check this for the reason:

  https://texfaq.org/FAQ-dolldoll

Best, Arash



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is there a way to force the directionality of a line of text in the GUI?
  2022-11-14  7:17 Is there a way to force the directionality of a line of text in the GUI? Evan Aad
  2022-11-15  9:20 ` Arash Esbati
@ 2022-11-15 11:13 ` Joost Kremers
  2022-11-15 11:48   ` Evan Aad
  1 sibling, 1 reply; 4+ messages in thread
From: Joost Kremers @ 2022-11-15 11:13 UTC (permalink / raw)
  To: Evan Aad; +Cc: help-gnu-emacs


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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is there a way to force the directionality of a line of text in the GUI?
  2022-11-15 11:13 ` Joost Kremers
@ 2022-11-15 11:48   ` Evan Aad
  0 siblings, 0 replies; 4+ messages in thread
From: Evan Aad @ 2022-11-15 11:48 UTC (permalink / raw)
  To: Joost Kremers; +Cc: help-gnu-emacs

On Tue, Nov 15, 2022 at 1:33 PM Joost Kremers wrote:
>  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.

I have solved the problem using the following workaround: I have added
the comment "%LTR" immediately after the second dollar sign. Now that
the line contains letters from the English alphabet, Emacs' bidi
algorithm recognizes it as English text, and therefore justifies it to
the left of the buffer. However, since this is a TeX comment, it is
ignored by the TeX compiler, and therefore affects the processing, and
the resulting typeset PDF file, in no way.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-15 11:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14  7:17 Is there a way to force the directionality of a line of text in the GUI? Evan Aad
2022-11-15  9:20 ` Arash Esbati
2022-11-15 11:13 ` Joost Kremers
2022-11-15 11:48   ` Evan Aad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).