emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Export code and results in one environment
@ 2015-05-22  2:54 Jacob Gerlach
  0 siblings, 0 replies; only message in thread
From: Jacob Gerlach @ 2015-05-22  2:54 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 903 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1432 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-22  2:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-22  2:54 Export code and results in one environment Jacob Gerlach

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).