How can I make org-mode markup work for a part of a word? For example, I'd like it to work for cases like this:

=Class=es

and this:

/Method/s

Based on my tests it seems like org-mode markup syntax works on complete words only.

  • If exporting to PDF, via LaTeX, it is possible to simply use the LaTeX solution directly in the org buffer. E.g. \textbf{V}alence \texttt{Aware} Dictionary Will print ony the "V" in bold-face, and the entire word "Aware" will appear in the org =verbatim= style. – n1k31t4 Mar 20 '16 at 16:30
up vote 6 down vote accepted

I don't think you can do it so that it shows up in the buffer as bold. If you just need it so that it appears bold when you export it to html, you can use:

th@<b>is is ha@</b>lf bold

See Quoting HTML tags

  • 2
    After reading bvk's reply mentioning a mailing list thread, I tracked down the thread, and thought to include a link to the developer's response. How to make part of a word bold in org-mode. – Joshua Taylor Mar 20 '12 at 16:35
  • 2
    In recent versions of org-mode, the syntax for quoting HTML strings has changed. To get th<b>is is ha</b>lf bold you'll have to write th@@html:<b>@@is is ha@@html:</b>@@lf bold. – itsjeyd Jul 2 '14 at 21:10
  • @itsjeyd's comment's solution worked for me in GNU Emacs 25.2.2. – Zelphir Mar 14 at 10:03

These days, there is a way to do this (without using quoted HTML tags):

(setcar org-emphasis-regexp-components " \t('\"{[:alpha:]")
(setcar (nthcdr 1 org-emphasis-regexp-components) "[:alpha:]- \t.,:!?;'\")}\\")
(org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)

Explanation

The manual says that org-emphasis-regexp-components can be used to

fine tune what characters are allowed before and after the markup characters [...].

It is a list containing five entries. The first entry lists characters that are allowed to immediately precede markup characters, and the second entry lists characters that are allowed to follow markup characters. By default, letters are not included in either one of these entries. So in order to successfully apply formatting to strings immediately preceded or followed by a letter, we have to add [:alpha:] (which matches any letter) to both entries.

This is what the calls to setcar do. The purpose of the third line is to rebuild the regular expression for emphasis based on the modified version of org-emphasis-regexp-components.

  • Nice! And, for the pedantic CL lovers out there, it also works to setf the car and cadr of org-emphasis-regexp-components. – Dan Aug 14 '14 at 10:07
  • ...and the call to org-set-emph-re affects not only bold (* *), but also italics (/ /), underline (_ _), and strikethrough (+ +). Super nice! – Dan Aug 14 '14 at 10:10
  • @Dan Thanks! And yes, it is supposed to be a generic solution. Too bad nobody has asked a generic question about it yet ;) – itsjeyd Aug 14 '14 at 10:21

No, you can't do that. I searched for the same solution before and found nothing. A (very) bad hack is to do something like *Class* es (with a whitespace).

Perhaps you can write a short message to the creator, Carsten Dominik (Homepage), and ask him for a solution. He seems to be a nice guy.

  • I just mailed into org-mode mailing list. – bvk Aug 3 '09 at 11:11
  • any follow-up on this? – Michael Paulukonis May 20 '13 at 3:26
  • 1
    @MichaelPaulukonis In case you are still interested, recent versions of org-mode can be customized to apply markup to parts of words. See my answer below. – itsjeyd Jul 2 '14 at 20:44

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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