1

Since the Emacs version upgrade to version 28 org-mode tables have become very small in size. Their font size has been reduced. Is there a way to tell Emacs to use the default font for the tables?

Minimal example that reproduces my issue:

* The quick brown fox jumps over the lazy dog (123 456 7890)

  The quick brown fox jumps over the lazy dog (123 456 7890)

  |  A | B                                                          |
  |----+------------------------------------------------------------|
  | 10 | The quick brown fox jumps over the lazy dog (123 456 7890) |
  | 20 | The quick brown fox jumps over the lazy dog (123 456 7890) |
  | 30 | The quick brown fox jumps over the lazy dog (123 456 7890) |

How it looks on my Emacs (emacs -q):

enter image description here

Org-mode normal text has this font:

mac-ct:-*-Menlo-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1 (#x51)

But org-mode table has this font:

mac-ct:-*-Courier-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1 (#x10)

Here is the C-u C-x = output of the normal text above the table:

             position: 88 of 473 (18%), column: 25
            character: p (displayed as p) (codepoint 112, #o160, #x70)
              charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x70
               script: latin
               syntax: w    which means: word
             category: .:Base, L:Strong L2R, a:ASCII, l:Latin, r:Roman
             to input: type "C-x 8 RET 70" or "C-x 8 RET LATIN SMALL LETTER P"
          buffer code: #x70
            file code: #x70 (encoded by coding system utf-8-unix)
              display: by this font (glyph code):
    mac-ct:-*-Menlo-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1 (#x53)

Character code properties: customize what to show
  name: LATIN SMALL LETTER P
  general-category: Ll (Letter, Lowercase)
  decomposition: (112) ('p')

There are text properties here:
  fontified            t

Here is the C-u C-x = output of the text in the table:

             position: 361 of 473 (76%), column: 26
            character: o (displayed as o) (codepoint 111, #o157, #x6f)
              charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x6F
               script: latin
               syntax: w    which means: word
             category: .:Base, L:Strong L2R, a:ASCII, l:Latin, r:Roman
             to input: type "C-x 8 RET 6f" or "C-x 8 RET LATIN SMALL LETTER O"
          buffer code: #x6F
            file code: #x6F (encoded by coding system utf-8-unix)
              display: by this font (glyph code):
    mac-ct:-*-Courier-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1 (#x52)

Character code properties: customize what to show
  name: LATIN SMALL LETTER O
  general-category: Ll (Letter, Lowercase)
  decomposition: (111) ('o')

There are text properties here:
  face                 org-table
  fontified            t

Output of M-x describe-face RET org-table RET:

Face: org-table (sample) (customize this face)

Documentation:
Face used for tables.

Defined in ‘org-faces.el’.


           Family: unspecified
          Foundry: unspecified
            Width: unspecified
           Height: unspecified
           Weight: unspecified
            Slant: unspecified
       Foreground: LightSkyBlue
DistantForeground: unspecified
       Background: unspecified
        Underline: unspecified
         Overline: unspecified
   Strike-through: unspecified
              Box: unspecified
          Inverse: unspecified
          Stipple: unspecified
             Font: unspecified
          Fontset: unspecified
           Extend: unspecified
          Inherit: fixed-pitch

How can I make org-mode table use the same font as normal text?

7
  • As noted on Reddit, I am unable to reproduce this issue. I see the exact same typeface, size and weight throughout, with only the foreground color differing between the three faces (default, org-level-1 and org-table). Solarized Dark theme, Emacs 28.1, Org 9.5.4, Manjaro. Commented Aug 1, 2022 at 23:23
  • Do C-u C-x = on a character in the table and add all the results (not just the font) to your question.
    – NickD
    Commented Aug 2, 2022 at 1:21
  • @PhilHudson Did you try with emacs -q? You mentioned Solarized Dark theme so I am not sure if you tried to reproduce the issue with emacs -q like I did or did you try to reproduce the issue with Solarized Dark theme and your other extensions enabled which may produce a different behavior than mine.
    – Eminent
    Commented Aug 3, 2022 at 7:48
  • @NickD Added the output of C-u C-x = for both normal text and table text in the question.
    – Eminent
    Commented Aug 3, 2022 at 7:48
  • With emacs -q I again get all three faces displaying the same typeface, size and weight, differing only in color. The un-themed typeface and colors are different from my normal themed ones, of course. Again, it seems certain that whatever issue you have encountered it is specific to your configuration, not an artefact of an upgrade (or not an upgrade alone, anyway). Commented Aug 3, 2022 at 9:34

1 Answer 1

1

No guarantees: it seems that since the org-table inherits from fixed-pitch, you get the font family of fixed-pitch which (unless you have modified things) is Monospace. I surmise that you don't have the Monospace family of fonts installed, so you end up going through face-font-family-alternatives for a fallback and that is courier.

This is all theory and surmise, so I could easily have been led astray.

There are a couple of things you can try:

  • If your default font Menlo has a monospaced version, you can try using that. The sizes should be compatible (at least much more compatible than Menlo and Courier). I believe you can do that by customizing the org-table face and getting rid of the :Inherit attribute and modifying the family to be that monospace font. That should fall back to Menlo. The trouble with this method is that if you ever change your default font, this is going to stick out like a sore thumb again. BTW, the org-table face must have a monospaced font, otherwise table alignment does not work.

  • You can let it fall back to Courier but customize the org-table face to have a somewhat bigger height. This will be trial and error, but maybe start with a scale value of 1.1, which will probably be too big so play around with it changing it very slightly until you are happy with the result.

  • you can use a different default font that has a monospaced version (e.g. Liberation) and arrange the fallback to be that font. See the docstring of face-font-family-alternatives for one way to do that.

I should warn you that what I know about fonts is pretty much what I've written here and I'm not even sure that it is correct, so caveat emptor.

3
  • Thanks for the detailed answer! Do you have some Elisp code or example I can use to get rid of :Inherit attribute from org-table face?
    – Eminent
    Commented Aug 3, 2022 at 23:35
  • Do M-x describe-face RET org-table RET and hit Customize, then uncheck the :Inherit attribute and Apply the customization. If it works, then hit Save as well so that it will be permanent. If it doesn't, restore to defaults.
    – NickD
    Commented Aug 4, 2022 at 15:44
  • 1
    It worked! Thanks @NickD for your help with this!
    – Eminent
    Commented Aug 6, 2022 at 8:34

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.