0

Org table vertical lines do not align properly with Chinese data.

| 標題一   | 標題二       | 標題三   |
|----------+--------------+----------|
| 中文圖表 | 直線會對不準 | 像這樣子 |
| 這       | 是不是       | 問題     |

| col1                      | col2                       | col3              |
|---------------------------+----------------------------+-------------------|
| this is a table           | there are few rows in here |                   |
| aligment is not a problem | at all                     | with english data |
|                           |                            |                   |

My version of org is 9.19.


POSSIBLE SOLUTIONS:

A possible solution is shared my coldnew over here. This re-adjusts font size system-wide so that one Chinese character corresponds to two ASCII letters.

;; Auto generated by cnfonts
;; <https://github.com/tumashu/cnfonts>
(set-face-attribute
 'default nil
 :font (font-spec :name "-*-Menlo-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1"
                  :weight 'normal
                  :slant 'normal
                  :size 20))
(dolist (charset '(kana han symbol cjk-misc bopomofo))
  (set-fontset-font
   (frame-parameter nil 'font)
   charset
   (font-spec :name "-*-STSong-normal-normal-normal-*-*-*-*-*-p-0-iso10646-1"
              :weight 'normal
              :slant 'normal
              :size 28.0)))

The above code is obtained from cnfonts after setting the relative font size for size 20 Menlo font.

Is there a way to make this apply only to the org-table face rather than globally?

  • 1
    It's aligned but you still need to adjust your font settings to ensure one Chinese character occupies twice width of one ASCII character. – xuchunyang Jun 29 at 10:27
  • How do I do that? – Sati Jun 29 at 10:39
  • Read the info manual and search the web. It's not so easy that there is a package to deal with the problem, see github.com/tumashu/cnfonts. – xuchunyang Jun 29 at 11:31
  • Is there a way to use a different font size only for org tables containing Chinese characters? I find the 1:2 ratio aesthetically unappealing when applied system-wide. cnfonts only allows us to use different profiles for different modes. – Sati Jul 3 at 16:27
  • 1
    look this, use org-table face set chinese font emacs-china.org/t/org-mode/440/66 – Pumkin Bob Jul 5 at 10:49

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.