reddit / emacs

Fixed-width code-blocks in org-mode

remillard · 2022-05-20 13:28
I am not a huge note taker, and we use Jira for organizing tasks at work. However, I've decided that org-mode isn't half bad at being a documentation companion, the easy tables are not as featured as I'd like but not half bad at quick register definition tables and such. I've been searching Google for the next thing I'd like to do, but haven't struck upon anything that doesn't require a lot of lisp. Surely there's just a Option mode or something for this. Basically I'd like to denote a section of an org document as a code-block for formatting. Just like Markdown and ``` or Reddit with four spaces on the side. Is there anyway to mark a section that should be rendered as a fixed-width font when exporting? I don't need to execute code or anything like that. I'd just like Markdown's "fixed-on" and "fixed-off" method. Any way to do that?
remillard · 2022-05-20 13:42
Kind of a related question, is there any way for it to STOP rendering text like BUFFER_TIMER as BUFFER(subscript)TIMER? It kind of plays merry hell with my variables if I mention them.
remillard · 2022-05-20 13:59
Okay, resolved both of these. Using the tildes around variables makes it monospace and ignore other mark up alterations, and `#+BEGIN_EXAMPLE` `#+END_EXAMPLE` seems to mark a section for "don't interpret this section".
annisquam · 2022-05-20 14:14
\`#+begin\_example\` and \`#+end\_example\` should do the trick if you want a generic block. \`C-c ,\` should get you started with the interactive block-creation interface.
fatfingerdeathcrunch · 2022-05-20 14:19
The documentation is pretty good. Check out https://orgmode.org/manual/Markup-for-Rich-Contents.html#Markup-for-Rich-Contents or if you want to have syntax highlighting for source code look at https://orgmode.org/manual/Working-with-Source-Code.html#Working-with-Source-Code
remillard · 2022-05-20 14:23
Yeah, it's not too bad, just tends to be scattered. I'd been relying on the compact version for speed, and then somehow missed the rich text section nearer to the bottom. Thanks!
remillard · 2022-05-20 14:24
Yes, that's what I discovered in the literal example section. I was trying to encapsulate a small drawing done with artist mode (state machine diagram). I tried `C-c ,` but honestly, I don't understand what it's trying to tell me about priority, so I'll just leave that alone until I have a need for it! Thanks.
RecentlyRezzed · 2022-05-21 06:04
#+OPTIONS: :nil
oantolin · 2022-05-22 10:46
`C-c ,` was a typo, it should be `C-c C-,`.
bestlem · 2022-07-11 11:30
This is the default as ^ begins superscript and _ subscript. This can be alterd to force subscripts only to be done if enclosed in {} ie to get what you see now you would need to type BUFFER_{TIMER} . This is done by customizing or setting org-use-sub-superscripts to '{}