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

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}


Note how the text a line of Hebrew with mixed English characters is rendered correctly when edited using TextEdit (i.e. test editor that comes with MacOS)

• I thought that inserting LEFT-TO-RIGHT MARK and RIGHT-TO-LEFT MARK (see gnu.org/software/emacs/manual/html_node/elisp/…) would have helped, but I can't make it work. For the record, this problem appears with most TeX editors, including TeXstudio, Texmaker, TeXworks, but not with vi which is able to correctly render the text out-of-the-box, oops. Jan 20 '16 at 18:26
• A follow up on this. To make it work we warp the phrase with LEFT-TO-RIGHT MARK (on both ends). After that is done the visual display corrects itself. It works beautifully! Jan 25 '16 at 15:29
• Please answer your own question, so other people can benefit from this solution ;-) Jan 25 '16 at 19:52

I've since find out that wrapping the phrase on both ends with the LEFT-TO-RIGHT MARK gives the desired result. To do that position your cursor appropriately and C-x 8 RET LEFT-TO-RIGHT MARK. The visual display will fix itself and the text will be shown correctly.