emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Adding export option for babel language


From: Ken Mankoff
Subject: [O] Adding export option for babel language
Date: Wed, 07 May 2014 22:46:07 -0400
User-agent: mu4e 0.9.9.6pre3; emacs 24.3.1

I'd like to add support for PythonTeX to Org Babel 
https://github.com/gpoore/pythontex

The motivation is that PythonTeX is a better literate environment than
just Org + Babel, because it can print results inline just like an
interactive Python session, instead of all the code followed by all the
results. 

This is just a modification to the existing LaTeX export for python, it
is not support for a new language. I'm new to Org development and seek
advice how to begin approaching the solution.

I'd like the python code blocks to behave just as they do now, but if I
have set (setq org-latex-listings 'pythontex) instead of (setq
org-latex-listings 'minted), then instead of wrapping python code blocks
with:

\begin{minted}[]{python}
x+2
print x
\end{minted}

It should wrap them with

\begin{pyconsole}
x+2
print x
\end{pyconsole}

I found out that the minted export is handled in ox-latex.el, and I
assume I could get pythontex support by going through that file and
tearing it down and building it back up with pythontex in place of
minted, but I also noticed this:

       ;; Case 2.  Custom environment.
       (custom-env (format "\\begin{%s}\n%s\\end{%s}\n"
                           custom-env
                           (org-export-format-code-default src-block info)
                           custom-env))

Can I take advantage of this code? It seems like this might be the
support for Special Blocks
http://orgmode.org/worg/org-contrib/org-special-blocks.html But that
page says that the code is obsolete. And a special block won't be
treated as a python org babel block in the Org file, which is important.

Any advice where I should start digging to add pythontex support will be
much appreciated.

Thanks,

  -k.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]