4

I'm using the "Charis SIL Compact" font for Org mode and everything looks fine except the second, third lines of list items that span multiple lines don't align properly.

enter image description here

When using a variable pitch font some elements don't align properly such as code blocks, tables, etc.. I have these rules applied:

(use-package org-faces
    :ensure nil
    :custom-face
    (org-table ((nil (:inherit fixed-pitch))))
    (org-block ((nil (:inherit fixed-pitch :foreground nil))))
    (org-code  ((nil (:inherit (shadow fixed-pitch)))))  
    (org-indent ((nil (:inherit (org-hide fixed-pitch)))))
    (org-special-keyword ((nil (:inherit (font-lock-comment-face fixed-pitch))))))

Any suggestion is welcome.

1
  • Are you using org-superstar (for example via Doom)? Or how do you get the UTF bullets?
    – orgtre
    Commented Mar 6, 2023 at 16:17

2 Answers 2

0

The left-most spaces should all have face org-indent assigned already (this is the default face of the wrap- and line-prefix text properties set by org-indent-mode). So the only way the misalignment can arise is if the width of the bullet or the space after it are of a different width than a space of font org-indent.

When I call C-u M-x what-cursor-position (or C-u C-x =) at the space after a bullet, the face is already org-indent, while doing the same at a bullet reveals its face is org-list-dt. Setting this face to inherit fixed-pitch like you do for org-indent should solve the alignment issue:

(use-feature org-faces
    :ensure nil
    :custom-face
    (org-table ((nil (:inherit fixed-pitch))))
    (org-block ((nil (:inherit fixed-pitch :foreground nil))))
    (org-code  ((nil (:inherit (shadow fixed-pitch)))))  
    (org-indent ((nil (:inherit (org-hide fixed-pitch)))))
    (org-special-keyword ((nil (:inherit (font-lock-comment-face fixed-pitch)))))
    (org-list-dt ((nil (:inherit fixed-pitch)))))

If this doesn't help, ensure that the UTF character used for the bullet isn't wider than a default fixed-pitch character. This can for example be done by evaluating (> (string-pixel-width "•") (frame-char-width)) in the scratch buffer with "•" replaced by whatever character you use for the bullet.

-1

Of course they don’t. The spaces at the beginning of the line are not the same width as the other characters. Since each character from a variable width font has a different width, there’s no way that they could ever line up.

4
  • Here's a website zzamboni.org/post/beautifying-org-mode-in-emacs as you can see in this image zzamboni.org/post/beautifying-org-mode-in-emacs/images/… they can line up
    – Zoli
    Commented Mar 3, 2023 at 23:04
  • The problem only happens when org-indent-mode is enabled.
    – Zoli
    Commented Mar 3, 2023 at 23:35
  • Here you say it's org-indent-mode that's causing it. In your question, you say the opposite. Which is it? Please fix the question if necessary.
    – NickD
    Commented Mar 4, 2023 at 19:51
  • The only way the variable-width font can be a problem here is if the width of the bullet and the space after it are of a different width than a space of font org-indent. So one solution would be to assign face org-indent (which is fixed-pitch) to these two characters.
    – orgtre
    Commented Mar 6, 2023 at 16:01

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.