9

My intention is to write Arabic document using org-mode. Please consider the following MWE, given that my configuration in init.el has below code to enable writing of Arabic script from right to left (rtl) instead of left to right (ltr) default behavior:

;; for right-to-left direction in org-mode
(defun set-bidi-env ()
  "interactive"
  (setq bidi-paragraph-direction 'nil))
(add-hook 'org-mode-hook 'set-bidi-env)

MWE.org buffer

# -*- mode: org -*-
#+OPTIONS: toc:1
#+LANGUAGE: ar
#+CREATOR: Emacs 25.1.50.2 (Org mode 8.3.4)

* تعريف بالارقام الهندية او الشرقية ١، ٢، ٣
* هذه النقطة الان باللغة العربية 

* ما هو الحل؟
* النهاية

* Introducing Hindi or estern numbers 1, 2, 3

* This point now in Arabic

* How to solve it?

* The end.

The last four points in English are translation of the first four bullets in Arabic. So now if I export it to HTML format by hitting C-c C-e h o I get this output:

enter image description here

Issues

  1. Table of Contents was not translated into Arabic as would be normally expected when language was set to ar. How to make org-mode aware of these Arabic equivalents of any document structure, e.g. TOC, chapter, figure, table, etc.

Update
This now is fixed. I updated the ox.el:

(org-export-smart-quotes-alist): add "ar" to the list

(org-export-dictionary): add Arabic equivalents to template keywords

so I would put only the relevant code to table of contents which is enough for the current MWE:

("Table of Contents"
 ("ar" :default "قائمة المحتويات")

enter image description here

  1. List numbers were in Arabic format 1,2,3 (yeah very counter-intuitive I know but bear with me please), while I wanted to appear in Hindi (see 1st list bullet in the output image). I want Hindi in Arabic language instead of 1, 2, 3 numbers. This applies to table of content also. How to achieve this customization?

Update
These are the hindi equivalent for arabic digits:

                 ("0" "\u0660")
                 ("1" "\u0661")
                 ("2" "\u0662")
                 ("3" "\u0663")
                 ("4" "\u0664")
                 ("5" "\u0665")
                 ("6" "\u0666")
                 ("7" "\u0667")
                 ("8" "\u0668")
                 ("9" "\u0669")

I hope this would come in handy to get it exported in case of Arabic language.

  1. Finally, as you can see in the output, the direction of the first four list items were from left to right not like what is expected in Arabic language from right to left. How to change direction depending on the context of script used (Arabic/English)?

Your help would be much appreciated.

1
  • When you say "I updated the ox.el" does that mean that you have fixes which could be contributed back to org-mode? If so, please create a bug report to do that?
    – phils
    Commented Sep 13, 2018 at 21:40

1 Answer 1

-1

I can partially answer this:

Finally, as you can see in the output, the direction of the first four list items were from left to right not like what is expected in Arabic language from right to left. How to change direction depending on the context of script used (Arabic/English)?

I don't know how to set RTL direction only for the first 4 items in Arabic and not for the rest 4 in English. But if you want to set the RTL direction for the whole page, it's more of an HTML question; the answer is from here.

Before

<html lang="ar"> 
..

After

<html dir="rtl" lang="ar"> 
..

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.