This morning I found out that Emacs org-mode has its own markdown entities, analogous to HTML entities or LaTeX commands. Often they’re identical to LaTeX commands. For example,
\approx is the approximation symbol ≈, exactly as in LaTeX.
So what’s the advantage of org-entities? In fact, how does Emacs even know whether
\approx is a LaTeX command or an org entity?
If you use the command
C-c C-x \ , Emacs will show you the compiled version of the entity, i.e. ≈ rather than the command
\approx. This is global: all entities are displayed. The org entities would be converted to symbols if you export the file to HTML or LaTeX, but this gives you a way to see the symbols before exporting.
Here something that’s possibly surprising, possibly useful. The symbol you see is for display only. If you copy and paste it to another program, you’ll see the entity text, not the symbol. And if you
C-c C-x \ again, you’ll see the command again, not the symbol; Note that the full name of the command is
org-toggle-pretty-entities with “toggle” the middle.
If you use
set-input-method to enter symbols using LaTeX commands or HTML entities as I described here, Emacs inserts a Unicode character and is irreversible. Once you type the LaTeX command \approx or the corresponding HTML entity
≈, any knowledge of how that character was entered is lost. So org entities are useful when you want to see Unicode characters but want your source file to remain strictly ASCII.
Incidentally, there are org entities for Hebrew letters, but only the first four, presumably because these are the only ones used as mathematical symbols.
To see a list of org entities, use the command
org-entities-help. Even if you never use org entities, the org entity documentation makes a nice reference for LaTeX commands and HTML entities. Here’s a screenshot of the first few lines.
2 thoughts on “Org entities”
Weird, my org mode doesn’t have this (org mode 9.3 in emacs 27.1)
Love these emacs related posts!
As you can see from the screenshot, It’s also possible to extend org mode entities by customizing the variable org-entities-user. It requires the symbol, a name and latex code and html code so it works with export as well. I’ve added latex’s \square and \whitediamond, for instance. That way you should be able to add the remaining hebrew letters. I’ve used customize-variable, but here’s the equivalent code:
‘((“whitediamond” “\\whitediamond” t “◇” “d” “d” “◇”)
(“square” “\\square” t “□” “■” “” “□”)))