I want to have python snippets in org thus:
#+begin_PYT
def foo(x):
# Some python code
#+end_PYT
where PYT
is a latex environment for python code using (say) listings.
The problem is that while org does translate #+begin_PYT
to \begin{PYT}
it modifies (transcodes??) the body; so for example
the python [[a]]
becomes an org link a!
As a result using vanilla org I have to do
#+begin_export latex
\begin{PYT}
def foo(x):
# Some python code
\end{PYT}
#+end_export
With dozens of small snippets those two extra lines are quite an overhead
So options (I can think of!)
- There should be a way in vanilla org to tell org that a
PYT
block should be left alone (not transcoded)
Or - Using org-special-blocks-extra there should be a way but there is very scant documentation.
- Write a 'pre-transcode' filter that transforms
#+begin_PYT
to"#+begin_export latex\n\\begin{PYT}"
Can someone help out with any of these (or some other!) way to do this?
#+begin_src python :exports code ... #+end_src
- that will use eitherlistings
orminted
depending on the setting oforg-latex-listings
.org-special-blocks-extra
does not provide an out-of-the-box solution to make the[[a]]
syntax not become org-links (otherwise, the, I would say, not so scant documentation of org-special-block-extras does explain, how to achieve what you want.