emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jacob Gerlach <jacobgerlach@gmail.com>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: Export code and results in one environment
Date: Fri, 22 May 2015 02:54:21 +0000	[thread overview]
Message-ID: <CAA6UvuFNL6zWOoj2MvkHbuPdCp3LuqX7UFi=CwWj_fSvkZkT1g@mail.gmail.com> (raw)

[-- 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 --]

                 reply	other threads:[~2015-05-22  2:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA6UvuFNL6zWOoj2MvkHbuPdCp3LuqX7UFi=CwWj_fSvkZkT1g@mail.gmail.com' \
    --to=jacobgerlach@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).