I hear and I forget. I see and I remember. I do and I understand. — Chinese Proverb

Thaana support for LaTex


LaTex is a typesetting system that is used to produce publication quality documents. LaTex is predominantly used by academics to produce technical/scientific/journal/conference papers. LaTex began its roots from Tex designed and developed by Donald Knuth around late 1970s. You can read more on the history from here. LaTex was developed by Lesslie Lamport around early 1980s.

LaTex is not for everyone. Most of us who are already very much used to wordprocessors such as Ms Word/LibreOffice Writer, the “point and click toolbar to get everything done” approach cannot be used. Everything is done using special markup or escape sequences of code. However, the benefit is that, you can be assured that the output and formatting is consistent all the time. The file is basically a plan text file, and the LaTex processor handles the processing and generation of the output (either PDF, PS, etc. format). More advantages and disadvantages here.

LaTex does not support Thaana typesetting natively. There are some packages such as bidi or babel that can be used for multilingual/right-to-left language support. LaTex uses packages to add features to the document. Similar to including library at the header when programming. But it wasn’t working out very well for Thaana. So XeTex was the preferred choice. Since I used XeTex for the task in hand, you must be wondering why I have been talking about LaTex all this while. The simple and honest answer is that most of us are familiar with LaTex and we often use it synonymously to refer to Tex style typesetting.

There are plenty of articles about producing documents in LaTex, but none specifically for Thaana/Dhivehi. So after a few hours research, I found out that it is possible to produce a decent document in Thaana. I was pleased with the results, given the nature of typesetting Thaana documents.

Things you would need:

  1. LaTex installed and running. Instructions for Windows/Mac/Linux here. When you install the LaTex installation from any of the packages, XeTex will also be installed, along with an editor. I would recommend using the editor, however, you can also use any text editor for creating the document. But then you would have to “compile” the document from command line to generate the output.
  2. Install polyglossia and fontspec installed if they are not already installed along with the LaTex. Polyglossia enables the right-to-left support. If you don’t use it, then the output using the standard packages will produce a mirror image for all the words in Thaana script (even if you type it correctly in the editor). Fontspec allows you to specify fonts that are installed on the system such as “Faruma” or any other unicode Thaana font, instead of the standard fonts that are used by default.
  3. Make sure your OS (Windows/Mac/Linux) has the Dhivehi/Maldives keyboard installed to allow you to actually type Thaana text in unicode. If you are already typing Thaana in Microsoft Word or LibreOffice, then you’ve probably completed this step.
  4. Finally install the Thaana unicode fonts that you like and start creating the document. The font that I’ve used is Faruma.

After completing the above requirements, you would have to place the following lines in the preamble before actually creating the content of the document. These lines tell the LaTex engine to use the polyglossia and fontspec packages, and sets “divehi” as the default language (it’s not a typo, that’s how divehi is spelled in this package) and sets “Faruma” as the default language.




The following are the source document and the output in PDF format.

  • LaTex source file: dhilatex.doc (This file was uploaded with extension .doc, because WordPress doesn’t allow to upload documents with .tex extension. Please download and rename to .tex extension before opening in the editor).

As you can see the bullets are alright, but the numbered list shows the “dot” after the number on the wrong side (in left-to-right format). Like I said before, it’s not perfect. Hopefully I will be posting more updates of my future experiments as this looks quite promising.


4 thoughts on “Thaana support for LaTex

  1. This is very good. However, the beauty of latex lies also in how it renders the fonts (Computer Modern family in english). Each letter is designed using Bezier curves of 70-odd degree. For latex to look as it should in Dhivehi, I think we also need properly designed fonts

    • I completely agree with you on this Annonymous. I feel that we are lack development with respect to integration and compatibility when it comes to Thaana and technology in so many domains, and one of the basic components are professionally designed standard fonts for different purposes. Thaana fonts have only grown popular and are adopted widely mostly because of word of mouth, and not through standardization. If I am not mistaken the only font that is even close to a standard recommendation is Faruma, which was the preferred Thaana font recommended by president’s office to use by government offices. And this was quite sometime ago.

      • How do you decided that Faruma was the closest to the standard. Because it was used in Presidents Office or because it looks closer to handwriting. Look at the positions of Fili in respect to the Akuru. Do you think this is standard? I would suggest you to look into fonts in more detail and then comment.

      • Hi Mercury. Thanks for the comment. I think if you read my comment more closely, you will see that “I did not suggest” Faruma was the closest to the standard. It was the President’s Office that made the recommendation in one of their circulars, hence becoming “the standard” thaana font used within the government. Thus it is a more “de facto” standard.

        And I re-iterate what I mentioned about lack of development in areas such as professional fonts. Hope that clarifies the confusion.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s