29

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.

1 Answer 1

36

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).

4
  • 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, 2014 at 6:11
  • 1
    @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, 2014 at 15:26
  • How to make this change specific to the current file? Jun 8, 2022 at 3:45
  • 1
    @Supernormal with hook.
    – Tokubara
    Dec 31, 2022 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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