I'm new to Emacs and Org-mode, this is a very basic question. Unfortunately the keywords are too common for me to find the answer.
I would like to create a custom pattern to colour my writing input.
Something like
_theorem: (it would detect _ and a non-whitespace character for the start, and would trace it until the end, or colon)
_theorem 2: (it would be great if this could also include whitespaces)
_theorem on topic 1: (such as this).
The script would thus automatically color all of the above writing that is now in bold. References that would help me do this would also be helpful. Many thanks for helping a beginner!
Update
I've added a follow-up question in the comments on adding multiple such rules that ran into problems. Here's the full code for it. While the first answer to the first question is working perfectly now, the other two new rules seem to be mistakenly formulated or in conflict somehow. On the instances where either of them is found, it breaks the regular coloring of org-mode and does no coloring itself.
(add-hook 'org-mode-hook
(lambda ()
(font-lock-add-keywords nil
'((
"\\(^\\|\\s-+\\)\\(_\\([a-zA-Z0-9]+\\s-?\\)\\{0,4\\}:\\)" 2
font-lock-type-face t)))
(font-lock-add-keywords nil
'((
"\\(\\w+\\(\\s-&\\s-\\w+\\)?,\\s-[0-9]\\{4\\})" 2
font-lock-type-face t)))
(font-lock-add-keywords nil
'((
"^\\w+:" 2
font-lock-type-face t)))
))