[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Adding export option for babel language
From: |
Charles Berry |
Subject: |
Re: [O] Adding export option for babel language |
Date: |
Thu, 8 May 2014 16:17:23 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Ken Mankoff <mankoff <at> gmail.com> writes:
>
>
> 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}
>
A quick-and-dirty approach to do just that much would be to write an export
filter for `src-block' and maybe `inline-src-block', see
(info "(org) Advanced configuration")
http://orgmode.org/worg/dev/org-export-reference.html#filter-system
and
http://orgmode.org/worg/exporters/filter-markup.html
Also, `C-h f org--filter TAB' should give you a buffer of such filter
functions (and a couple of false positives) that you might browse.
HTH,
Chuck