emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: Jeff Rush <jrush@taupro.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Unable to Style RESULTS Blocks
Date: Mon, 21 May 2012 07:58:22 -1000	[thread overview]
Message-ID: <m1ipfpmn5t.fsf@tsdye.com> (raw)
In-Reply-To: <4FBA7D38.4020505@taupro.com> (Jeff Rush's message of "Mon, 21 May 2012 12:36:56 -0500")

Aloha Jeff,

Jeff Rush <jrush@taupro.com> writes:

> Using org-babel, I cannot figure out how to make the export of the
> results of execution appear in LaTeX as a shaded box, like I see on so
> many of the org-mode websites.
>
> #+name: example
> #+BEGIN_SRC python -n :results output :exports both
>   print "Hello World"
> #+END_SRC
>
> #+results: example
> : Hello World
>
> The results are exported as:
>
> \begin{verbatim}
>  Hello World
> \end{verbatim}
>
> which lacks any shading/borders.  The org-mode documentation at:
>
>   http://orgmode.org/worg/org-tutorials/org-latex-export.html
>
> shows this example but the example expects the results to be wrapped in
> a 'results' environment instead of the 'verbatim' environment I'm seeing.
>
> #+LaTeX_HEADER: \usepackage{framed}
> #+LaTeX_HEADER: \usepackage{xcolor}
> #+LaTeX_HEADER: \definecolor{shadecolor}{gray}{.95}
> #+LaTeX_HEADER: \newenvironment{results}{\begin{shaded}}{\end{shaded}}
>
> I'm running org-mode 7.8.03 under Linux, and I've defined my own LaTeX
> document class to format the other parts of my document.  I am new to
> LaTeX though.  I just expected the formatting of source and results to
> be a well-solved problem w/good looking defaults in org-mode.
>
> -Jeff

You can wrap a results block any way you like with the :wrap header
argument, e.g.,

#+name: example
#+BEGIN_SRC python -n :results output :exports both :wrap results
  print "Hello World"
#+END_SRC

#+RESULTS: example
#+BEGIN_results
Hello World
#+END_results

Or,

#+name: example
#+BEGIN_SRC python -n :results output :exports both :wrap foo
  print "Hello World"
#+END_SRC

#+RESULTS: example
#+BEGIN_foo
Hello World
#+END_foo

If you have loaded org-special-blocks, then

#+LaTeX_HEADER: \usepackage{framed}
#+LaTeX_HEADER: \usepackage{xcolor}
#+LaTeX_HEADER: \definecolor{shadecolor}{gray}{.95}
#+LaTeX_HEADER: \newenvironment{results}{\begin{shaded}}{\end{shaded}}
#+LaTeX_HEADER: \newenvironment{foo}{\begin{framed}}{\end{framed}}

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

  reply	other threads:[~2012-05-21 17:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-21 17:36 Unable to Style RESULTS Blocks Jeff Rush
2012-05-21 17:58 ` Thomas S. Dye [this message]
2012-05-21 18:28   ` Mikhail Titov
2012-05-21 21:39     ` Thomas S. Dye
2012-05-21 22:17       ` Mikhail Titov

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=m1ipfpmn5t.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jrush@taupro.com \
    /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).