Skip to main content
5 of 5
Improve help reicpe
user avatar
user avatar

However, if I try to do the same with Devanagari script (itrans inscript), table columns don't get aligned properly.

Use valign from GNU ELPA.

From the blurb

This package provides visual alignment for Org Mode, Markdown and table.el tables on GUI Emacs. It can properly align tables containing variable-pitch font, CJK characters and images. Meanwhile, the text-based alignment generated by Org mode (or Markdown mode) is left untouched.

For the sake of demonstration, this is what I did

  1. Install valign with M-x pacakge-refresh-contents and M-x package-install RET valign RET

  2. Add the following to your init file (or eval it)

(add-hook 'org-mode-hook #'valign-mode)
  1. Copy your devanagari table to an org file.
| क | ख | ग | घ | ङ |
| च | छ | ज | झ | ञ |
| ट | ठ | ड | ढ | ण |
| त | थ | द | ध | न |
| प | फ | ब | भ | म |
  1. Do M-x revert-buffer when in above org buffer

  2. Mission accomplished.

What you see below is the screenshot of before and after valign is activated.

An org buffer with indic script without and with valign-mode

valign is disabled when the table size exceeds a specific threshold. So, if you happen to notice that some of your tables are mis-aligned, even when valign-mode is ON, then you may have to configure valign-max-table-size to a higher value.

For the sake of record, and if you haven't already noticed ... You DO NOT need to do all the jugglery with fonts and their widths suggested in the other responses. This is because the valign library measures pixel-width when doing alignment.

user31220