14

What's the simplest way of forcing Emacs org-mode to use the same fixed-width Font Family and Height everywhere (but keeping other properties distinct, like Foreground)?

I could make all org-level-n faces inherit from fixed-pitch, or make variable-pitch actually reference a fixed-width font, for instance, but that would be cumbersome, I guess.

Thanks in advance.

rsenna
  • 315
  • 3
  • 9
  • 1
    Hello. Are you using a custom theme or the Emacs default? Some themes change certain faces, e.g. Org headings. Also, have you changed the default Emacs font or tweaked some faces? By default Emacs sets a fixed-width/monospace font. – undostres Nov 26 '14 at 21:56
  • Hey @undostres, I'm using [Bozhidar Batsov's Solarized for Emacs](https://github.com/bbatsov/solarized-emacs). – rsenna Nov 27 '14 at 11:06
  • 3
    Hmm, just as I thought. That theme introduces more "intrusive" changes than others. The README file in the repository shows some variables you can change to avoid some modifications, but if I recall correctly the variable-width font can't be changed. A workaround: use another Solarized implementation like [this one](https://github.com/purcell/color-theme-sanityinc-solarized) or [this one](https://github.com/sellout/emacs-color-theme-solarized). But if you don't want to switch themes, you'll need to apply some face changes above Batsov's theme. – undostres Nov 27 '14 at 15:31
  • @undostres Thanks man, you were right, problem was the color theme that I was using. – rsenna Nov 27 '14 at 16:18
  • 1
    Sure! NP. I'm an Org heavy user and had the same issue with that theme. Finally decided to changed it instead of trying some hack (which can be done, nevertheless). – undostres Nov 27 '14 at 17:05
  • 1
    Set some settings in [Theme specific settings](https://github.com/bbatsov/solarized-emacs#theme-specific-settings) to disable font size changes. – Ivan Sviatenko Jun 29 '15 at 10:04

2 Answers2

11

Some themes change faces for no good reason.

For example, if you are using Solarized theme add code below before loading it.

(setq solarized-use-variable-pitch nil
      solarized-scale-org-headlines nil)
rgtk
  • 414
  • 5
  • 9
4

I would use face-remap-add-relative; see the Face Remapping section of the Emacs Lisp manual.

Here's a hook that sets the "family" property of the default face in Org mode buffers to "Monospace", effectively turning default into fixed-pitch.

(add-hook 'org-mode-hook
          (lambda () (face-remap-add-relative 'default :family "Monospace")))
Constantine
  • 9,072
  • 1
  • 34
  • 49
  • Funny. For me, that had the opposite effect: all org fonts are now proportional (both headings and list items). Before that at least the list items were displayed with a monospace font. – rsenna Nov 27 '14 at 11:23
  • I use `face-remap-add-relative` too, and it works for me (I don't have "Monospace" but use "Input Sans Mono" instead). There are also several other faces you might want to mess with, all named org-*something*. – amitp Nov 27 '14 at 15:54