神刀安全网

Org as a Word Processor

I’ve been asked this question a few times:

Hi, First of all thanks for you good work, I saw on youtube, I would like to ask you two questions:

  1. How did you manage to display images on org-mode in this presentation ?
  2. How to make org-mode titles with big font sizes and color like yours in this presentation.

Again thanks.

While I never intended to make Org Mode look or behave like a word processor , but with slight tweaks every now and then, that is my end result. Although all my code is in my dot-files repository, I figured I better highlight just the applicable code.

Just the Italics, Thanks

Sure /org italic/ characters look kinda like slanted words, but with the added baggage of having regular expression characters in your prose. Hide them with a simple setting:

(setq org-hide-emphasis-markers t)

Keep in mind that the slash characters (and asterisks for bold, etc) are still there , but aren’t displayed. Want to change them? No big deal, just backspace over them.

Better Bullets

Asterisks and dashes for bullet lists are fine, but having an actual circular bullet , is just nice :

(font-lock-add-keywords 'org-mode                         '(("^ +//([-*]//) "                            (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))

This code uses a regular expression of lines with initial spaces, followed by either a dash or asterisks and a single space into a Unicode bullet.

Better Header Bullets

When I started my switch from Markdown to org-mode, the visual annoyance was how headers looked. Top-level with a single bullet was fine (just not really a header), but sub-bullets with more bullets seemed wrong. This is why I liked the org-bullets project.

Once installed from MELPA, just add the following to your .emacs init file:

(require 'org-bullets) (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))

Better Headers

I like some of the ideas in the EMagicians Starter Kit , particularly how the headers are larger, instead of different colors. My code in this case is particular nasty and needs a major simplification, but here is the gist for you:

(let* ((variable-tuple (cond ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro"))                              ((x-list-fonts "Lucida Grande")   '(:font "Lucida Grande"))                              ((x-list-fonts "Verdana")         '(:font "Verdana"))                              ((x-family-fonts "Sans Serif")    '(:family "Sans Serif"))                              (nil (warn "Cannot find a Sans Serif Font.  Install Source Sans Pro."))))        (base-font-color     (face-foreground 'default nil 'default))        (headline           `(:inherit default :weight bold :foreground ,base-font-color)))    (custom-theme-set-faces 'user                           `(org-level-8 ((t (,@headline ,@variable-tuple))))                           `(org-level-7 ((t (,@headline ,@variable-tuple))))                           `(org-level-6 ((t (,@headline ,@variable-tuple))))                           `(org-level-5 ((t (,@headline ,@variable-tuple))))                           `(org-level-4 ((t (,@headline ,@variable-tuple :height 1.1))))                           `(org-level-3 ((t (,@headline ,@variable-tuple :height 1.25))))                           `(org-level-2 ((t (,@headline ,@variable-tuple :height 1.5))))                           `(org-level-1 ((t (,@headline ,@variable-tuple :height 1.75))))                           `(org-document-title ((t (,@headline ,@variable-tuple :height 1.5 :underline nil))))))

First step in the above code decides on a font. You should probably trim this down to your favorite variable space font.

Summary

Let’s get Emacs out of full-screen mode, and load a file that demonstrates these settings to view the end result:

Org as a Word Processor

Notice the light-blue is the code settings (I change it to a different color since I’m already using a fixed width font for default). Also, I’m using Tomorrow theme, and in this screen shot, I’m using the Hasklig font. Let me know if I’ve missed anything, or if you have any particularly good tips!

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Org as a Word Processor

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
分享按钮