From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Treat custom environment as verbatim on export Date: Sat, 23 May 2015 09:32:28 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwCLk-0005L1-Pq for emacs-orgmode@gnu.org; Sat, 23 May 2015 12:32:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YwCLg-0002jl-Ba for emacs-orgmode@gnu.org; Sat, 23 May 2015 12:32:36 -0400 Received: from iport-acv2-out.ucsd.edu ([132.239.0.174]:35806) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwCLg-0002iK-3j for emacs-orgmode@gnu.org; Sat, 23 May 2015 12:32:32 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jacob Gerlach Cc: Org-mode On Fri, 22 May 2015, Jacob Gerlach wrote: > Hello, > > I want to use a one of several custom environments for some babel > results using, for example, ":wrap myverbatim" as a header argument. > (Since I have several possible environments, I think I need to use > :wrap rather than, say, replacing "verbatim" using an export filter). > > However, since this block isn't recognized as an actual verbatim > environment, markup gets processed in undesirable ways. > > For example: > > ------------- > #+BEGIN_SRC sh :exports results :wrap myverbatim > echo "Hello_world" > #+END_SRC > > #+RESULTS: > #+BEGIN_myverbatim > Hello_world > #+END_myverbatim > ------------- > exports to > ------------- > \begin{myverbatim} > Hello\(_{\text{world}}\) > \end{myverbatim} > ------------- > instead of > ------------- > \begin{myverbatim} > Hello_world > \end{myverbatim} > ------------- > > A couple questions: > > - Is there any way I've missed to specify verbatim export as an option > for an arbitrary block/environment? > You can use arbritrary latex environments inside a latex block with these header arguments: : :results raw :wrap latex :post postenv("env-name-goes-here") If you define a wrapper for the results like this: #+NAME: postenv #+BEGIN_SRC emacs-lisp :var env="myverb" :exports none (format "\\begin{%s}\n%s\\end{%s}" env *this* env) #+END_SRC Then calling #+header: :results raw :wrap latex :post postenv("myverbatim") #+BEGIN_SRC sh :exports results echo "Hello_world" #+END_SRC gives: ,---- | \begin{myverbatim} | Hello_world | \end{myverbatim} `---- under latex export. The `:results raw' is needed particularly for multiline results. See the manual for each of those header args for more info. You can also do this using :prologue and :epilogue, but I think :post is a bit neater. HTH, Chuck