reddit / emacs
How do I type a literal asterisk * as the first character in the normal text portion of org mode?
Status-Detective-783 · 2022-02-14 05:04
I'm very new to emacs and org mode, and I'm simply going through tutorials and trying simple stuff out. Using macport. I want this:
* Key Bindings Examples (This is a heading)
(The following is plain text.)
M-s o regex buffer to new window (M-x occur)
* Type an asterisk to start a heading
** Type two asterisks for 2nd level heading, etc.
However, if I try to do that, then the last two lines become actual headings. This stack exchange answer might effectively contain a good answer, but I wanted to double-check here. https://emacs.stackexchange.com/questions/16688/how-can-i-escape-the-in-org-mode-to-prevent-bold-fontification
modifiedenby · 2022-02-14 05:12
If you want the first character to be an asterisk when exporting, try writing a space before it.
Status-Detective-783 · 2022-02-14 05:30
I'm new and don't even understand exporting yet. What I want is simply this:
* Key Bindings Examples (This is a heading)
(The following is plain text.)
M-s o regex buffer to new window (M-x occur)
* Type an asterisk to start a heading
** Type two asterisks for 2nd level heading, etc.
However, if I try to do that, then the last two lines become actual headings.
danderzei · 2022-02-14 06:51
Use something like this:
#+begin_src org
,* Heading 1
,** Heading 2
,*** Heading 3
#+end_src
citrusmunch · 2022-02-14 07:00
one of the SO comments mentions this, but [pretty entities](https://orgmode.org/manual/Special-Symbols.html) is prob the way to go.
asterisk doesn't seem included so you'll have to add it yourself
Status-Detective-783 · 2022-02-14 07:15
When I write that, it literally looks exactly like that, and not like what I want.
danderzei · 2022-02-14 07:24
This method is the only way to escape asterisks etc. The commas and SRC markers are not visible in exports.
Emacs is not a WYSIWYG word processor, so you cannot hide everything you don't want to see. There would be simply no way for Emacs to understand the difference between a heading or a non-heading without additional characters.
Status-Detective-783 · 2022-02-14 07:27
Asterisk is included! \ast
Then use
C-c C-x = (org-toggle-pretty-entities)
The other option is a zero width SPC character. There's pros/cons to each. The org style police seem to prefer the former.
Status-Detective-783 · 2022-02-14 07:33
Evidently, I can get what I want from pretty entities, "\ast", and (org-toggle-pretty-entities).
danderzei · 2022-02-14 07:39
Nice workaround. This is what I love about Emacs - there is always a way.
You can add `#+startup: entitiespretty` so that the buffer starts with this variable set (only the buffer).
dcreno · 2022-02-14 12:31
It seems semantically correct to use a code block for your use-case. Even in this question, you put it in a code block.
You are trying to demonstrate how to code using the Org language. Therefore, I would prefer the code block over pretty entities.
nnomae · 2022-02-14 13:30
There are a whole bunch of different asterisk variants in unicode. https://unicode-search.net/unicode-namesearch.pl?term=ASTERISK
Maybe you could use one of those instead?
Status-Detective-783 · 2022-02-14 13:55
Now that's a creative option, thanks!
Status-Detective-783 · 2022-02-14 14:03
Ahh I figured I was misunderstanding something here. This perfectly helps me understand my missing mental context for /u/danderzei's code block answer, thanks!
Status-Detective-783 · 2022-02-14 14:49
Oh! Actually on second thought, this is a perfect solution since it also works BEFORE exporting. I'm just writing free-form text, like note taking, so I can just put a space before everything on that line. This is clearly the most simple solution for this specific use-case. The following works just fine.
* Key Bindings Examples (This is a heading)
<- one space here
M-s o regex buffer to new window (M-x occur)
* Type an asterisk to start a heading
** Type two asterisks for 2nd level heading, etc.
modifiedenby · 2022-02-14 15:23
I disagree – that isn't code but a table. A star in a table also wouldn't trigger a heading.
[deleted] · 2022-02-14 17:43
[deleted]