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.
CodyChan
  • 2,599
  • 1
  • 19
  • 33

1 Answers1

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

erikstokes
  • 12,686
  • 2
  • 34
  • 56
  • 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 06: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](https://lists.gnu.org/archive/html/emacs-orgmode/2013-02/msg00405.html). – erikstokes Dec 30 '14 at 15:26
  • How to make this change specific to the current file? – Supernormal Jun 08 '22 at 03:45
  • 1
    @Supernormal with hook. – Tokubara Dec 31 '22 at 09:05