emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Unable to Style RESULTS Blocks


From: Thomas S. Dye
Subject: Re: [O] Unable to Style RESULTS Blocks
Date: Mon, 21 May 2012 07:58:22 -1000

Aloha Jeff,

Jeff Rush <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]