[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Using Variable Width Fonts for org-mode and Fixed Width forTable

From: Alan Schmitt
Subject: Re: [O] Using Variable Width Fonts for org-mode and Fixed Width forTabless
Date: Fri, 27 Sep 2013 09:19:49 +0200
User-agent: mu4e; emacs 24.3.1

Hi Ian,

address@hidden writes:

> I am struggling to get this to work. In my init files I have:
> (set-default-font "DejaVu Serif Italic")
> I have followed the advice on StackOverflow 
> http://stackoverflow.com/questions/3758139/variable-pitch-for-org-mode-fixed-pitch-for-tables
> and customized my Init file to include:
> (set-face-attribute 'org-table nil :inherit 'fixed-pitch)
> However, table formatting is still screwed up. C-u C-x = shows
>      xft:-unknown-IM FELL DW 
> Pica-normal-italic-normal-*-15-*-*-*-*-0-iso10646-1 (#x29)
> Character code properties: customize what to show
>    general-category: Lu (Letter, Uppercase)
>    decomposition: (70) ('F')
> There are text properties here:
>    face                 org-table
>    fontified            t
>    line-prefix          [Show]
>    wrap-prefix          [Show]
> I have tried setting the font for org-table using Emacs Customize 
> Interface, but without any success. Ideally I want tables to use a 
> monospace font like Inconsolata or DejaVu mono. Can anyone provide an 
> example of how to set org-table to use a specified fixed width font.

I've played a little with this, and here is what I have (straight from
my config file).

First, I set up the font for variable pitch, and I tell emacs to use it
for text modes.

** setup
#+BEGIN_SRC emacs-lisp
  (set-face-attribute 'variable-pitch nil :family "Ubuntu")
  (set-face-attribute 'variable-pitch nil :height 140)
  (add-hook 'text-mode-hook 'variable-pitch-mode)

Then I set up exceptions for some faces in some modes. I have exceptions
for info, mu4e, and org mode. Here are the ones for org mode.

** org

#+BEGIN_SRC emacs-lisp
  (defun my-adjoin-to-list-or-symbol (element list-or-symbol)
    (let ((list (if (not (listp list-or-symbol))
                    (list list-or-symbol)
      (require 'cl-lib)
      (cl-adjoin element list)))
   (lambda (face)
      face nil
       (face-attribute face :inherit))))
   (list 'org-code 'org-block 'org-table 'org-block-background 'org-date 
'org-link 'org-footnote))

What this says is: use fixed-pitch for the faces in the list at the
end. I have to include dates, links, and footnotes because I use them in
tables and I don't know how to conditionally change a face (i.e., use
fixed-pitch for links in tables but not for links in other places).

Hopefully this will work for you.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]