The problem with mixing RTL and LTR is that symbols (spaces included) are neutral to text direction, so they automatically follow the previous text direction, which also changes according to the character of the language used.
Imagine you want to write this single line :
The استقامة : (فعل : استقام [past]
- يستقيم [present] - استقم [imperative])
You get,
this, if you have LTR as default :
The استقامة : (فعل : استقام [past] -
يستقيم [present] - استقم
[imperative])
Or that, if you have RTL as default :
The استقامة : (فعل : استقام [past] -
يستقيم [present] - استقم
[imperative])
*To correct the problem I will use Windows Notepad.*
you can use any text editor that support unicode bidirection characters.
First, we know that the example is an LTR paragraph, so we insert LRE
unicode character, then type The then استقامة,
LRE
The استقامة
Type space, colon and the open parenthesis,
LRE
The استقامة : (
Problems are going to happen here : If you type a letter after the parenthesis this will changes its direction according the letter, if you type in Arabic, the text and parenthesis will continue to the left of استقامة .If you type Latin letters then the text and parenthesis will continue to the right of استقامة.
To avoid this problem we want the Arabic word to behave as if it was a Latin word, so we insert LRM
unicode character after it to force this behaviour,
LRE
The استقامةLRM
: (
Now, we want to type inside the parenthesis, but wait ! There is a mixed LTR and RTL text and symbols and spaces!
The solution is that we notice that the sentence between parenthesis follows a RTL direction, in that case, we insert RLE
unicode character,
LRE
The استقامةLRM
: (RLE
then continue typing all remaining things except the closing parenthesis (type the begin and closing brackets as if you normally type Latin text),
RLE
The استقامة LRM
: (RLE
فعل
: استقام [past] - يستقيم [present] -
استقم [imperative]
then insert the unicode character PDF
Pop Directional Format which closes the RTL block and type the closing parenthesis,
RLE
The استقامة LRM
: (RLE
فعل :
استقام [past] - يستقيم [present] -
استقم [imperative]PDF
)
And then, you close the LTR paragraph with the PDF
unicode character,
RLE
The استقامة LRM
: (RLE
فعل :
استقام [past] - يستقيم [present] -
استقم [imperative]PDF
)PDF
Now the paragraph will keep the same order even if you change the global text direction.
Finally🥴, you select all (prefer CTRL
+A
to be sure that you will copy all invisible control characters), then paste it in your Writer document.
This is a summary in notepad and how to access the unicode control characters :
More info : Bidirectional text - Wikipedia