I'm using Emacs to typeset a document which has English as its main language but which will use Hebrew and Greek as well.

You can see on my screenshot how the \footnote command shows two open brackets as opposed to the correct open and close brackets.

{\footnoteA{This is a Hebrew related footnote

as opposed to the correct way

\footnoteA{This is a Hebrew related footnote}

The end result however, on the PDF is correct.

Incorrect handling of left-to-right text within a right-to-left paragraph

This is a MWE:

\setotherlanguages{greek, hebrew}
\setmainfont{SBL BibLit}

בְּרֵאשִׁ֖ית\footnoteA{This is a Hebrew related footnote} בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃

  Ἐν ἀρχῇ\footnoteA{This is a Greek related footnote} ἐποίησεν ὁ
  θεὸς τὸν οὐρανὸν καὶ τὴν γῆν.

closed as off-topic by giordano, user13907, Martin Schröder, Romain Picot, egreg Feb 2 '16 at 9:17

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Having a test file could be useful. – giordano Jan 19 '16 at 7:31
  • @giordano I've added a MWE. Thank you for the suggestion. – filipeamoreira Jan 20 '16 at 2:09
  • 4
    I'm voting to close this question as off-topic because this question has been already asked and answered at emacs.stackexchange.com/q/19696/620 – giordano Feb 2 '16 at 8:40

Emacs version 25.1 added support for Bidirectional Parentheses Algorithm (aka "paired brackets" in UAX 9) which helps a bit: I'm seeing:

visual order: DETAERC DOG footnoteA{this is a hebrew related footnote}\GNINNIGEB EHT NI

Note backslash is still weirdly placed.

I've never tried but Emacs bidi is somewhat tweakable (I think it's even partially implemented in Elisp?), so it ought to be possible to further optimize it for mixed LaTeX. E.g. treating \ as [weak] LTR character might help?

But whatever you do there will be messy situations. My favorite strategy is to insert newlines before and after any problematic opposite-direction portions (this btw helps across editors) :

footnote content on its own line

LaTeX's empty-line-delimits-paragraphs rule makes such newlines usually safe, though sometimes % is needed.

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