23

I know I can use *bold*, /italic/, _underlined_, =verbatim= and ~code~, and, if you must, ‘+strike-through+’ to do some markup to text according to org-mode documentation, but they are not enough for me(bold is not obvious when viewing the org file), I know I can customize org-emphasis-alist, but the documentation doesn't tell much. What I want is to highlight the text selected like enriched-mode like the image in this page.

enter image description here

But enriched-mode will save the file as text/enriched format, and I have to use enriched-mode not org-mode itself.

So, how can I re-define or define a new markup(maybe customize org-emphasis-alist) to highlight text like enriched-mode, so

  1. the highlight is permanent in this file(I can see the highlight in Emacs)
  2. at the same time it can be exported into pdf or html file.
21

You can change what face is used to display bold (or any other) markup by adding a new entry to org-emphasis-alist. For example, to make *bold* display in red, use

(add-to-list 'org-emphasis-alist
             '("*" (:foreground "red")
               ))

You will have to restart org-mode (with org-mode-restart) for this to take effect.

Trying to add new markup characters like this doesn't seem to work, it only changes how the existing markup is displayed in Emacs.

This doesn't affect exports at all. *bold* still exports to whatever bold means in that format (e.g. <b>bold</b> in html or \textbf{bold} in Latex).

  • I use "(setq org-emphasis-alist (append org-emphasis-alist '(("`" bold))))" to create a new markup, but it doesn't work, what is wrong with it? – CodyChan Dec 30 '14 at 6:11
  • @CodyChan The first problem is with the append, which puts the new element at the end, but we need it at the beginning so it gets found first. Just swap the arguments. The second problem is that it appears to be impossible to add new markup, according to the org-mode mailing list. – erikstokes Dec 30 '14 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.