3

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

12
  • 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
    – user12563
    Feb 6, 2017 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, 2017 at 17:55
  • 1
    Possible duplicate of Japanese / CJK font settings for proper horizontal alignment
    – wasamasa
    Feb 6, 2017 at 23:05
  • @wasamasa, an update has been added explaining why this question is different.
    – doctorate
    Feb 7, 2017 at 16:30
  • 1
    Not a solution, but at least a way to isolate the problem. Some character glyphs in Arabic combine two distinct letters into one, which takes up only one character width. There is only one word with such a character in your table: الاسم, which has the أ + ل being displayed (correctly) as لا. Based on your screenshot with Droid Sans Mono, you can see that the table columns get exactly one character off right after الاسم, and nowhere else.
    – Dan
    Feb 8, 2017 at 22:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.