Qwerty
Qwerty

Reputation: 41

Making a word partly italic in org-mode

When working in Emacs org-mode, how do I make a word part italic? I want this:

wordx

but when I try word/x/ it produces

word/x/

and word{/x/} produces

word{x}

Upvotes: 4

Views: 630

Answers (1)

olaf b
olaf b

Reputation: 606

You can do this by creating a custom link.

Simple method:

(org-add-link-type "emph" nil 'org-export-emph)

(defun org-export-emph (path desc format)
  (let ((text (or desc path)))
    (cond
     ((eql format 'html)
      (format "<em>%s</em>" text))
     ((eql format 'latex)
      (format "\\emph{%s}" text))
     (t
      text))))

This then allows you to write par[[emph:ti]]ally em[[emph:ph][ph]]asized words.

Better (?) method:

You only define the link type by

(org-add-link-type "emph")

and handle that link type via a generic trancoder in your exporter backend.

Upvotes: 1

Related Questions