emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Export code and results in one environment


From: Jacob Gerlach
Subject: [O] Export code and results in one environment
Date: Fri, 22 May 2015 02:54:21 +0000

Hello,

I'd like to export a source block and it's results together in one latex environment. I came up with a solution using the final filter below.

Is there a better way?

Thanks,
Jake

  #+BEGIN_SRC emacs-lisp :exports none :results silent
    (defun combine-verb-final-filter (s backend info)
      (when (eq backend 'latex)
      (replace-regexp-in-string "\\\\end{verbatim}\n*\\\\begin{verbatim}"
                                "" 
                                s nil t)))
    (add-to-list 'org-export-filter-final-output-functions 'combine-verb-final-filter)
  #+END_SRC

Works, given:
--------------------------------------
#+BEGIN_SRC sh :exports both
echo "Hello"
#+END_SRC

#+RESULTS:
: Hello
--------------------------------------
Produces (desired effect):
--------------------------------------
\begin{verbatim}
echo "Hello"

Hello
\end{verbatim}
--------------------------------------

reply via email to

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