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}
--------------------------------------