# Handling left-to-right inside right-to-left paragraphs using Emacs and AUCTeX [closed]

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.

This is a MWE:

\documentclass{article}
\usepackage{reledmac}
\usepackage{reledpar}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguages{greek, hebrew}
\setmainfont{SBL BibLit}
\begin{document}
\begin{pairs}
\begin{Leftside}
\beginnumbering
\begin{hebrew}
\pstart

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

\pend
\end{hebrew}
\endnumbering
\end{Leftside}
\begin{Rightside}
\beginnumbering
\begin{greek}
\pstart
Ἐν ἀρχῇ\footnoteA{This is a Greek related footnote} ἐποίησεν ὁ
θεὸς τὸν οὐρανὸν καὶ τὴν γῆν.
\pend
\end{greek}
\endnumbering
\end{Rightside}
\end{pairs}
\Column
\end{document}


## closed as off-topic by giordano, user13907, Martin Schröder, Romain Picot, egregFeb 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
• 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:

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) :

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