This is a followup to yesterday’s post on Nicolas P. Rougier’s notebook-mode. When I was going through the code trying to understand how everything worked I noticed that the Org source code had a #+begin_sidefig
/ #+end_sidefig
environment that mapped to a <div class="sidefig" id="org08c8fb0">
element in the HTML. The definition of that division was provided by the CSS of course, but I wondered where the mapping came from. My first thought was that it must have been implemented in a package that the code required but I couldn’t figure out what package it was or how it was being included.
It turns out that you can use begin_xxx
/ end_xxx
for any value of xxx
and Org will do the right thing. If you export the Org file to HTML it will be mapped into a <div>
that you can define in a CSS file (or in the Org file, for that matter). If you export it to PDF (via LaTeX) it will be mapped into a \begin{xxx}
/ \end{xxx}
environment that, once again, you can define however you like.
Many of you are probably already aware of this but it’s a revelation to me. It means that you can produce arbitrarily beautiful output directly from Org-mode. Doubtless something similar happens if you export to docx
but Irreal has no interest such matters.
If you’re exporting to HTML, you can provide environment definitions in a CSS file. If you’re exporting to to PDF, you can define the definitions in a LaTeX package definition or directly in the Org file. It’s another example of how Org-mode allows you to generate arbitrarily complex output.