unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: Evan Aad <oddeveneven@gmail.com>
Cc: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <87sfiktpt2.fsf@fastmail.fm> (raw)
In-Reply-To: <CA+-Lr-CaUQROjZzqnSZ=-Tw=x+WbXXoSxoomddFfebMWpSGjmw@mail.gmail.com>


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



  parent reply	other threads:[~2022-11-15 11:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-11-15 11:48   ` Evan Aad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfiktpt2.fsf@fastmail.fm \
    --to=joostkremers@fastmail.fm \
    --cc=help-gnu-emacs@gnu.org \
    --cc=oddeveneven@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).