1

I really enjoy writing bidirectional text in org-mode using Emacs as it supports the rt-to-left direction out of the box. However, when it comes to org tables alignment things become very unorganized.

I have this setup in my init.el file for correct RTL display in org file taken from this post:

(defun set-bidi-env ()
  "interactive"
  (setq bidi-paragraph-direction 'nil))
(add-hook 'org-mode-hook 'set-bidi-env)

MWE with a table in English vs Arabic to show the difference

* Tables in English (no alignment problems)

| No | Name           |             Tel |  Rate | Result |
|----+----------------+-----------------+-------+--------|
|  1 | John Doe       | +1-541-754-3010 | 34.99 | Fail   |
|  2 | Johnson Kirton | +1-541-754-3010 | 55.89 | Pass   |
|  3 | Debbie Cannon  | +1-541-754-3456 | 66.45 | Pass   |

* Tables in Arabic (problems with alignment)

| رقم | الاسم         |          الهاتف | المعدل | النتيجة |
|-----+---------------+-----------------+--------+---------|
| ١   | جون دو        | +1-541-754-3010 | ٣٤.٩٩  | فشل     |
| ٢   | جونسون كيرتون | +1-541-754-3010 | ٥٥.٨٩  | نجاح    |
| ٣   | ديبي كانون    | +1-541-754-3456 | ٦٦.٤٥  | نجاح    | 

* And this text in English after the tables

* وهذا نص باللغة العربية بعد ادراج الجداول

Screenshot to show the display enter image description here

See the alignment in the Arabic table below how it is different from that of the table in English as ugly to neat. Is there any fix to get it right?

Update

Using an Arabic monospaced font (Kawkab Mono) as kindly suggested by @Do didn't solve the problem.

Not a Duplicate

A similar issue has been reported for Japanese here, but the solutions presented there didn't help solve my problem. Changing the font to "Inconsolata-12" for example didn't change anything in the table alignment, this could be only applicable to the Japanese characters but not to Arabic ones. Neither font type nor size did improve the appearance of the alignment. The second solution in the same post, to my understanding (article in Chinese) is to try out specific pair sizes for English and the SECOND language but as I said, changing font size didn't work for me.

enter image description here

Another Monospaced Font

Trying out Droid Sans Mono did improve the appearance but it didn't solve it completely and in a larger table the bad alignment would be much worse. I ran out of ways to seek a TYPICAL monospaced Arabic font that will fix it. I wonder if such a font does exist!!

enter image description here

  • It seems that this problem happens because your arabic font isn't monospace, and org expects that text is displayed with a monospace font. Consider using another font such as this one: makkuk.com/kawkab-mono – DoMiNeLa10 Feb 6 '17 at 17:07
  • @DoMiNeLa10 this is to confirm that I installed the monspaced arabic font as you kindly suggested and used it in my emacs setup, yet the problem persists. – doctorate Feb 6 '17 at 17:55
  • 1
    Possible duplicate of Japanese / CJK font settings for proper horizontal alignment – wasamasa Feb 6 '17 at 23:05
  • @wasamasa, an update has been added explaining why this question is different. – doctorate Feb 7 '17 at 16:30
  • The "Use Inconsolata-12" answers for Japanese didn't really fix Japanese either--they just happened to get close to looking right. I actually had to find a monospace Japanese font that rendered Japanese characters as the right widths, and you might need to do the same for Arabic. This part is deceptively hard because even through there are fonts that support Arabic with monospaced Latin, you'll need to look for one with monospaced Arabic. I know you said you did this already, so this might sound redundant, but you might want to investigate your fonts some more, because they can be deceptive. – Archenoth Feb 7 '17 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.