This is the emacs side of a question I asked on the Latex SE.
This other emacs question is also related but for now I am assuming its not an issue
Short version
I want the best of two worlds:
- The org-tab behavior of *-ed headlines
- The Latex typesetting nuance of
\newtheorem
applied on these headlines
IOW I want headlines -- maybe slightly doctored -- to behave as headlines in emacs; and to export as math in Latex. Except that instead of Equation Lemma Theorem etc I want Law Fact Action
This table summarizes
Idea | Emacs code | Latex Behavior |
---|---|---|
Law | * Text :L: |
$\odot$ Law nn Text |
Fact | * Text :F: |
$\boxdot$ Fact nn Text |
Action | * Text :A: |
\checkmark Action nn Text |
nn's are the auto-numbering of org-latex as it normally works
Longer Version
Say I have a heading like
* Recursion before Iteration :L:
I want it to become on the latex side (something like)
\textbf{$\odot$ Law nn. Recursion before Iteration}
One thing I (guess) I want is a full scale preprocessor of org-export
So something like a sed modification on the buffer before export
Added Later
After writing the above I found this question with this answer.
That gives me greater clarity.
So there is the function org-export-ignore-headlines
in ox-extra.el
How do I change it so that on Latex export
* Lorem Ipsum :L:
is converted to
#+BEGIN_LAW
Lorem Ipsum
#+END_LAW
[Assume that a suitable law
environment has been created in the style file using newtheorem
In response to TMar
No your attempt does not work.
If I give:
* A
** Recursion before Iteration :LAW:
Lorem Ipsum
I get
\begin{document}
\tableofcontents
\#+BEGIN\textsubscript{LAW}
\section{A}
\label{sec:org196f793}
\#+END\textsubscript{LAW}
Recursion before Iteration :LAW:
Lorem Ipsum
\end{document}
IOW
- sequencing of fragments is wrong
- timing is wrong -- its happening after begin blocks are processed
The second point can be obviated by simply replacing the #+BEGIN_LAW
by \begin{law}
. But what should go in the block is going outside the block.
In answer to NickD
Two alternatives
The simpler one
*** Recursion before Iteration :L: # nothing allowed here inside
becomes
#+begin_law Recursion before Iteration #+end_law
More fiddly but hopefully not too hairy! Assume that
:ignore:
headlines are ignored though their contents are exported according toorg-export-ignore headlines
. So*** Recursion before Iteration :L: Lorem ipsum etc
becomes
*** Dummy :ignore: #+begin_law Recursion before Iteration #+end_law Lorem Ipsum etc