emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Exporting via babel to LaTeX
@ 2012-05-28 18:48 John Hendy
  2012-05-28 18:56 ` Achim Gratz
  2012-05-28 21:32 ` Thomas S. Dye
  0 siblings, 2 replies; 11+ messages in thread
From: John Hendy @ 2012-05-28 18:48 UTC (permalink / raw)
  To: emacs-orgmode

I've only ever used src blocks to make plots or create files to
include. I have my first opportunity to actually try and include both
code and results and have a question about spacing. You won't have my
data, but this is pretty simple stuff.:

#+begin_src R :session basic :results output :exports both
nrow(data)
#+end_src
#+begin_src R :session basic :results output :exports both
nrow(nonzero.data)
#+end_src

I split them up because I wanted the results like so:

Code-A
Results-A
Code-B
Results-B

If I kept them together, it came out Code-A, Code-B, then Results-A, Results-B.

Anyway, the LaTeX output is creating the following:

\begin{verbatim}
nrow(data)
\end{verbatim}

\begin{verbatim}
 [1] 681
\end{verbatim}

\begin{verbatim}
nrow(nonzero.data)
\end{verbatim}

\begin{verbatim}
 [1] 455
\end{verbatim}

This gives really, really spaced out results. I'd prefer output that
looks more like an R terminal output, which can be done by not putting
code and results in separate verbatim blocks. Is this standard
spacing/behavior or is there an option/exporter tweak I can use on
this? It just ends up taking so much space.

I'm super new to this and barely know anything about the header
arguments at all. I will say I was thrilled to find out about the
:session option. I was worried about "walking through code" because I
rely on initial block results to carry through to the others. What do
you know? There's a way to do that :) Thanks for this wonderful
implementation. I've seen it come up on the list hundreds of time and
have to say it's really cool actually getting to work with it!


Best regards,
John

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Exporting via babel to LaTeX
  2012-05-28 18:48 Exporting via babel to LaTeX John Hendy
@ 2012-05-28 18:56 ` Achim Gratz
  2012-05-28 21:32 ` Thomas S. Dye
  1 sibling, 0 replies; 11+ messages in thread
From: Achim Gratz @ 2012-05-28 18:56 UTC (permalink / raw)
  To: emacs-orgmode

John Hendy writes:
> This gives really, really spaced out results. I'd prefer output that
> looks more like an R terminal output, which can be done by not putting
> code and results in separate verbatim blocks.

It seems to me that this constitutes a feature request to export the
complete session transcript (i.e. input and output together into one
block).  I'm don't know if that is easily implementable, but it would
surely be a nice thing to have in general for languages that produce
their output interspersed with their input.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Exporting via babel to LaTeX
  2012-05-28 18:48 Exporting via babel to LaTeX John Hendy
  2012-05-28 18:56 ` Achim Gratz
@ 2012-05-28 21:32 ` Thomas S. Dye
  2012-05-28 23:02   ` John Hendy
  2012-05-28 23:10   ` John Hendy
  1 sibling, 2 replies; 11+ messages in thread
From: Thomas S. Dye @ 2012-05-28 21:32 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

John Hendy <jw.hendy@gmail.com> writes:

> I've only ever used src blocks to make plots or create files to
> include. I have my first opportunity to actually try and include both
> code and results and have a question about spacing. You won't have my
> data, but this is pretty simple stuff.:
>
> #+begin_src R :session basic :results output :exports both
> nrow(data)
> #+end_src
> #+begin_src R :session basic :results output :exports both
> nrow(nonzero.data)
> #+end_src
>
> I split them up because I wanted the results like so:
>
> Code-A
> Results-A
> Code-B
> Results-B
>
> If I kept them together, it came out Code-A, Code-B, then Results-A, Results-B.
>
> Anyway, the LaTeX output is creating the following:
>
> \begin{verbatim}
> nrow(data)
> \end{verbatim}
>
> \begin{verbatim}
>  [1] 681
> \end{verbatim}
>
> \begin{verbatim}
> nrow(nonzero.data)
> \end{verbatim}
>
> \begin{verbatim}
>  [1] 455
> \end{verbatim}
>
> This gives really, really spaced out results. I'd prefer output that
> looks more like an R terminal output, which can be done by not putting
> code and results in separate verbatim blocks. Is this standard
> spacing/behavior or is there an option/exporter tweak I can use on
> this? It just ends up taking so much space.
>
> I'm super new to this and barely know anything about the header
> arguments at all. I will say I was thrilled to find out about the
> :session option. I was worried about "walking through code" because I
> rely on initial block results to carry through to the others. What do
> you know? There's a way to do that :) Thanks for this wonderful
> implementation. I've seen it come up on the list hundreds of time and
> have to say it's really cool actually getting to work with it!
>
>
> Best regards,
> John
>
>
Hi John,

One way to do this would be to redefine the verbatim environment in
LaTeX.  There is a fancyvrb package for LaTeX that might help with this.

I think a better answer to your query has two parts.  

1) Make Org-mode distinguish your code and results, instead of having
them both be verbatim environments.  One way to do this would be to use
listings or minted to typeset the source code blocks: see
http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12.

Then use :wrap foo to wrap the results in a foo environment.  

2) Configure LaTeX to typeset the new environments in a way that pleases
you. LaTeX specifies for each environment the space to leave before it
and after it.  You should be able to set these so the results please
you.  Here is one example for how to modify the results block:
http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-2.
Note that this was written for an earlier version of Org-mode, before
results blocks were stored in drawers.  Instead of "results" use "foo".

You'll need to consult the listings or minted packages to configure one
of them.

In effect, you will be taking advantage of LaTeX's semantic markup.

hth,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Exporting via babel to LaTeX
  2012-05-28 21:32 ` Thomas S. Dye
@ 2012-05-28 23:02   ` John Hendy
  2012-05-28 23:35     ` Thomas S. Dye
  2012-05-28 23:10   ` John Hendy
  1 sibling, 1 reply; 11+ messages in thread
From: John Hendy @ 2012-05-28 23:02 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

On Mon, May 28, 2012 at 4:32 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
> John Hendy <jw.hendy@gmail.com> writes:
>
>> I've only ever used src blocks to make plots or create files to
>> include. I have my first opportunity to actually try and include both
>> code and results and have a question about spacing. You won't have my
>> data, but this is pretty simple stuff.:
>>
>> #+begin_src R :session basic :results output :exports both
>> nrow(data)
>> #+end_src
>> #+begin_src R :session basic :results output :exports both
>> nrow(nonzero.data)
>> #+end_src
>>
>> I split them up because I wanted the results like so:
>>
>> Code-A
>> Results-A
>> Code-B
>> Results-B
>>
>> If I kept them together, it came out Code-A, Code-B, then Results-A, Results-B.
>>
>> Anyway, the LaTeX output is creating the following:
>>
>> \begin{verbatim}
>> nrow(data)
>> \end{verbatim}
>>
>> \begin{verbatim}
>>  [1] 681
>> \end{verbatim}
>>
>> \begin{verbatim}
>> nrow(nonzero.data)
>> \end{verbatim}
>>
>> \begin{verbatim}
>>  [1] 455
>> \end{verbatim}
>>
>> This gives really, really spaced out results. I'd prefer output that
>> looks more like an R terminal output, which can be done by not putting
>> code and results in separate verbatim blocks. Is this standard
>> spacing/behavior or is there an option/exporter tweak I can use on
>> this? It just ends up taking so much space.
>>
>> I'm super new to this and barely know anything about the header
>> arguments at all. I will say I was thrilled to find out about the
>> :session option. I was worried about "walking through code" because I
>> rely on initial block results to carry through to the others. What do
>> you know? There's a way to do that :) Thanks for this wonderful
>> implementation. I've seen it come up on the list hundreds of time and
>> have to say it's really cool actually getting to work with it!
>>
>>
>> Best regards,
>> John
>>
>>
> Hi John,
>
> One way to do this would be to redefine the verbatim environment in
> LaTeX.  There is a fancyvrb package for LaTeX that might help with this.
>
> I think a better answer to your query has two parts.

Thanks for the input!

>
> 1) Make Org-mode distinguish your code and results, instead of having
> them both be verbatim environments.  One way to do this would be to use
> listings or minted to typeset the source code blocks: see
> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12.
>
> Then use :wrap foo to wrap the results in a foo environment.
>

So... foo could be verbatim or something like that shaded example in
the worg tutorial above? I'm thinking the code and results would still
be in different environments when the PDF is generated, right? You're
just suggesting that I put them in an environment that doesn't insert
so much white space?

> 2) Configure LaTeX to typeset the new environments in a way that pleases
> you. LaTeX specifies for each environment the space to leave before it
> and after it.  You should be able to set these so the results please
> you.  Here is one example for how to modify the results block:
> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-2.
> Note that this was written for an earlier version of Org-mode, before
> results blocks were stored in drawers.  Instead of "results" use "foo".
>

It will take me a while to figure all of this out. I don't know either
of these packages!

> You'll need to consult the listings or minted packages to configure one
> of them.
>
> In effect, you will be taking advantage of LaTeX's semantic markup.

Thanks again! I'll have a look into this this week.

John

>
> hth,
> Tom
> --
> Thomas S. Dye
> http://www.tsdye.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Exporting via babel to LaTeX
  2012-05-28 21:32 ` Thomas S. Dye
  2012-05-28 23:02   ` John Hendy
@ 2012-05-28 23:10   ` John Hendy
  2012-05-28 23:30     ` Thomas S. Dye
  1 sibling, 1 reply; 11+ messages in thread
From: John Hendy @ 2012-05-28 23:10 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

On Mon, May 28, 2012 at 4:32 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
> John Hendy <jw.hendy@gmail.com> writes:
>
>> I've only ever used src blocks to make plots or create files to
>> include. I have my first opportunity to actually try and include both
>> code and results and have a question about spacing. You won't have my
>> data, but this is pretty simple stuff.:
>>
>> #+begin_src R :session basic :results output :exports both
>> nrow(data)
>> #+end_src
>> #+begin_src R :session basic :results output :exports both
>> nrow(nonzero.data)
>> #+end_src
>>
>> I split them up because I wanted the results like so:
>>
>> Code-A
>> Results-A
>> Code-B
>> Results-B
>>
>> If I kept them together, it came out Code-A, Code-B, then Results-A, Results-B.
>>
>> Anyway, the LaTeX output is creating the following:
>>
>> \begin{verbatim}
>> nrow(data)
>> \end{verbatim}
>>
>> \begin{verbatim}
>>  [1] 681
>> \end{verbatim}
>>
>> \begin{verbatim}
>> nrow(nonzero.data)
>> \end{verbatim}
>>
>> \begin{verbatim}
>>  [1] 455
>> \end{verbatim}
>>
>> This gives really, really spaced out results. I'd prefer output that
>> looks more like an R terminal output, which can be done by not putting
>> code and results in separate verbatim blocks. Is this standard
>> spacing/behavior or is there an option/exporter tweak I can use on
>> this? It just ends up taking so much space.
>>
>> I'm super new to this and barely know anything about the header
>> arguments at all. I will say I was thrilled to find out about the
>> :session option. I was worried about "walking through code" because I
>> rely on initial block results to carry through to the others. What do
>> you know? There's a way to do that :) Thanks for this wonderful
>> implementation. I've seen it come up on the list hundreds of time and
>> have to say it's really cool actually getting to work with it!
>>
>>
>> Best regards,
>> John
>>
>>
> Hi John,
>
> One way to do this would be to redefine the verbatim environment in
> LaTeX.  There is a fancyvrb package for LaTeX that might help with this.
>
> I think a better answer to your query has two parts.
>
> 1) Make Org-mode distinguish your code and results, instead of having
> them both be verbatim environments.  One way to do this would be to use
> listings or minted to typeset the source code blocks: see
> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12.
>
> Then use :wrap foo to wrap the results in a foo environment.
>
> 2) Configure LaTeX to typeset the new environments in a way that pleases
> you. LaTeX specifies for each environment the space to leave before it
> and after it.  You should be able to set these so the results please
> you.  Here is one example for how to modify the results block:
> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-2.
> Note that this was written for an earlier version of Org-mode, before
> results blocks were stored in drawers.  Instead of "results" use "foo".
>

To follow up on this because it seemed a bit simper..., I added the
example to my file:

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

But it doesn't change anything. Since it says this will affect a
"results block," I [intuitively] tried:

#+begin_results
test
#+end_results

But don't see anything different. Did I mis-interpret how this works?
Or do I need the above /with/ either minted or listing and it's not
standalone?


Thanks,
John


> You'll need to consult the listings or minted packages to configure one
> of them.
>
> In effect, you will be taking advantage of LaTeX's semantic markup.
>
> hth,
> Tom
> --
> Thomas S. Dye
> http://www.tsdye.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Exporting via babel to LaTeX
  2012-05-28 23:10   ` John Hendy
@ 2012-05-28 23:30     ` Thomas S. Dye
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas S. Dye @ 2012-05-28 23:30 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

John Hendy <jw.hendy@gmail.com> writes:

> On Mon, May 28, 2012 at 4:32 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>> John Hendy <jw.hendy@gmail.com> writes:
>>
>>> I've only ever used src blocks to make plots or create files to
>>> include. I have my first opportunity to actually try and include both
>>> code and results and have a question about spacing. You won't have my
>>> data, but this is pretty simple stuff.:
>>>
>>> #+begin_src R :session basic :results output :exports both
>>> nrow(data)
>>> #+end_src
>>> #+begin_src R :session basic :results output :exports both
>>> nrow(nonzero.data)
>>> #+end_src
>>>
>>> I split them up because I wanted the results like so:
>>>
>>> Code-A
>>> Results-A
>>> Code-B
>>> Results-B
>>>
>>> If I kept them together, it came out Code-A, Code-B, then Results-A, Results-B.
>>>
>>> Anyway, the LaTeX output is creating the following:
>>>
>>> \begin{verbatim}
>>> nrow(data)
>>> \end{verbatim}
>>>
>>> \begin{verbatim}
>>>  [1] 681
>>> \end{verbatim}
>>>
>>> \begin{verbatim}
>>> nrow(nonzero.data)
>>> \end{verbatim}
>>>
>>> \begin{verbatim}
>>>  [1] 455
>>> \end{verbatim}
>>>
>>> This gives really, really spaced out results. I'd prefer output that
>>> looks more like an R terminal output, which can be done by not putting
>>> code and results in separate verbatim blocks. Is this standard
>>> spacing/behavior or is there an option/exporter tweak I can use on
>>> this? It just ends up taking so much space.
>>>
>>> I'm super new to this and barely know anything about the header
>>> arguments at all. I will say I was thrilled to find out about the
>>> :session option. I was worried about "walking through code" because I
>>> rely on initial block results to carry through to the others. What do
>>> you know? There's a way to do that :) Thanks for this wonderful
>>> implementation. I've seen it come up on the list hundreds of time and
>>> have to say it's really cool actually getting to work with it!
>>>
>>>
>>> Best regards,
>>> John
>>>
>>>
>> Hi John,
>>
>> One way to do this would be to redefine the verbatim environment in
>> LaTeX.  There is a fancyvrb package for LaTeX that might help with this.
>>
>> I think a better answer to your query has two parts.
>>
>> 1) Make Org-mode distinguish your code and results, instead of having
>> them both be verbatim environments.  One way to do this would be to use
>> listings or minted to typeset the source code blocks: see
>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12.
>>
>> Then use :wrap foo to wrap the results in a foo environment.
>>
>> 2) Configure LaTeX to typeset the new environments in a way that pleases
>> you. LaTeX specifies for each environment the space to leave before it
>> and after it.  You should be able to set these so the results please
>> you.  Here is one example for how to modify the results block:
>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-2.
>> Note that this was written for an earlier version of Org-mode, before
>> results blocks were stored in drawers.  Instead of "results" use "foo".
>>
>
> To follow up on this because it seemed a bit simper..., I added the
> example to my file:
>
> #+LaTeX_HEADER: \usepackage{framed}
> #+LaTeX_HEADER: \usepackage{xcolor}
> #+LaTeX_HEADER: \definecolor{shadecolor}{gray}{.95}
> #+LaTeX_HEADER: \newenvironment{results}{\begin{shaded}}{\end{shaded}}
>
> But it doesn't change anything. Since it says this will affect a
> "results block," I [intuitively] tried:
>
> #+begin_results
> test
> #+end_results
>
> But don't see anything different. Did I mis-interpret how this works?
> Or do I need the above /with/ either minted or listing and it's not
> standalone?
>
>
> Thanks,
> John
>
>
Hi John,

This should be independent of listings and/or minted.

Does the .tex file have
\begin{results}
test
\end{results}
?

If so, then the new results environment should be printed in a shaded
box when LaTeX is done processing it (if your LaTeX distribution has the
framed and xcolor packages).  If not, then you need to use
org-special-blocks.

hth,
Tom

>> You'll need to consult the listings or minted packages to configure one
>> of them.
>>
>> In effect, you will be taking advantage of LaTeX's semantic markup.
>>
>> hth,
>> Tom
>> --
>> Thomas S. Dye
>> http://www.tsdye.com

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Exporting via babel to LaTeX
  2012-05-28 23:02   ` John Hendy
@ 2012-05-28 23:35     ` Thomas S. Dye
  2012-05-29  2:33       ` John Hendy
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas S. Dye @ 2012-05-28 23:35 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

John Hendy <jw.hendy@gmail.com> writes:

> On Mon, May 28, 2012 at 4:32 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>> John Hendy <jw.hendy@gmail.com> writes:
>>
>>> I've only ever used src blocks to make plots or create files to
>>> include. I have my first opportunity to actually try and include both
>>> code and results and have a question about spacing. You won't have my
>>> data, but this is pretty simple stuff.:
>>>
>>> #+begin_src R :session basic :results output :exports both
>>> nrow(data)
>>> #+end_src
>>> #+begin_src R :session basic :results output :exports both
>>> nrow(nonzero.data)
>>> #+end_src
>>>
>>> I split them up because I wanted the results like so:
>>>
>>> Code-A
>>> Results-A
>>> Code-B
>>> Results-B
>>>
>>> If I kept them together, it came out Code-A, Code-B, then Results-A, Results-B.
>>>
>>> Anyway, the LaTeX output is creating the following:
>>>
>>> \begin{verbatim}
>>> nrow(data)
>>> \end{verbatim}
>>>
>>> \begin{verbatim}
>>>  [1] 681
>>> \end{verbatim}
>>>
>>> \begin{verbatim}
>>> nrow(nonzero.data)
>>> \end{verbatim}
>>>
>>> \begin{verbatim}
>>>  [1] 455
>>> \end{verbatim}
>>>
>>> This gives really, really spaced out results. I'd prefer output that
>>> looks more like an R terminal output, which can be done by not putting
>>> code and results in separate verbatim blocks. Is this standard
>>> spacing/behavior or is there an option/exporter tweak I can use on
>>> this? It just ends up taking so much space.
>>>
>>> I'm super new to this and barely know anything about the header
>>> arguments at all. I will say I was thrilled to find out about the
>>> :session option. I was worried about "walking through code" because I
>>> rely on initial block results to carry through to the others. What do
>>> you know? There's a way to do that :) Thanks for this wonderful
>>> implementation. I've seen it come up on the list hundreds of time and
>>> have to say it's really cool actually getting to work with it!
>>>
>>>
>>> Best regards,
>>> John
>>>
>>>
>> Hi John,
>>
>> One way to do this would be to redefine the verbatim environment in
>> LaTeX.  There is a fancyvrb package for LaTeX that might help with this.
>>
>> I think a better answer to your query has two parts.
>
> Thanks for the input!
>
>>
>> 1) Make Org-mode distinguish your code and results, instead of having
>> them both be verbatim environments.  One way to do this would be to use
>> listings or minted to typeset the source code blocks: see
>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12.
>>
>> Then use :wrap foo to wrap the results in a foo environment.
>>
>
> So... foo could be verbatim or something like that shaded example in
> the worg tutorial above? I'm thinking the code and results would still
> be in different environments when the PDF is generated, right? You're
> just suggesting that I put them in an environment that doesn't insert
> so much white space?
>
You'll probably have to create a LaTeX environment that doesn't insert so
much white space.  Best to do this with a new environment, rather than
redefining one of the existing LaTeX environments, IMHO.

The white space problem is something to correct at the LaTeX step, after
Org-mode has wrapped the blocks in semantically meaningful environments.

hth,
Tom

>> 2) Configure LaTeX to typeset the new environments in a way that pleases
>> you. LaTeX specifies for each environment the space to leave before it
>> and after it.  You should be able to set these so the results please
>> you.  Here is one example for how to modify the results block:
>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-2.
>> Note that this was written for an earlier version of Org-mode, before
>> results blocks were stored in drawers.  Instead of "results" use "foo".
>>
>
> It will take me a while to figure all of this out. I don't know either
> of these packages!
>
>> You'll need to consult the listings or minted packages to configure one
>> of them.
>>
>> In effect, you will be taking advantage of LaTeX's semantic markup.
>
> Thanks again! I'll have a look into this this week.
>
> John
>
>>
>> hth,
>> Tom
>> --
>> Thomas S. Dye
>> http://www.tsdye.com
>

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Exporting via babel to LaTeX
  2012-05-28 23:35     ` Thomas S. Dye
@ 2012-05-29  2:33       ` John Hendy
  2012-05-29  3:29         ` Thomas S. Dye
  0 siblings, 1 reply; 11+ messages in thread
From: John Hendy @ 2012-05-29  2:33 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

On Mon, May 28, 2012 at 6:35 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
> John Hendy <jw.hendy@gmail.com> writes:
>
>> On Mon, May 28, 2012 at 4:32 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>>> John Hendy <jw.hendy@gmail.com> writes:
>>>
>>>> I've only ever used src blocks to make plots or create files to
>>>> include. I have my first opportunity to actually try and include both
>>>> code and results and have a question about spacing. You won't have my
>>>> data, but this is pretty simple stuff.:
>>>>
>>>> #+begin_src R :session basic :results output :exports both
>>>> nrow(data)
>>>> #+end_src
>>>> #+begin_src R :session basic :results output :exports both
>>>> nrow(nonzero.data)
>>>> #+end_src
>>>>
>>>> I split them up because I wanted the results like so:
>>>>
>>>> Code-A
>>>> Results-A
>>>> Code-B
>>>> Results-B
>>>>
>>>> If I kept them together, it came out Code-A, Code-B, then Results-A, Results-B.
>>>>
>>>> Anyway, the LaTeX output is creating the following:
>>>>
>>>> \begin{verbatim}
>>>> nrow(data)
>>>> \end{verbatim}
>>>>
>>>> \begin{verbatim}
>>>>  [1] 681
>>>> \end{verbatim}
>>>>
>>>> \begin{verbatim}
>>>> nrow(nonzero.data)
>>>> \end{verbatim}
>>>>
>>>> \begin{verbatim}
>>>>  [1] 455
>>>> \end{verbatim}
>>>>
>>>> This gives really, really spaced out results. I'd prefer output that
>>>> looks more like an R terminal output, which can be done by not putting
>>>> code and results in separate verbatim blocks. Is this standard
>>>> spacing/behavior or is there an option/exporter tweak I can use on
>>>> this? It just ends up taking so much space.
>>>>
>>>> I'm super new to this and barely know anything about the header
>>>> arguments at all. I will say I was thrilled to find out about the
>>>> :session option. I was worried about "walking through code" because I
>>>> rely on initial block results to carry through to the others. What do
>>>> you know? There's a way to do that :) Thanks for this wonderful
>>>> implementation. I've seen it come up on the list hundreds of time and
>>>> have to say it's really cool actually getting to work with it!
>>>>
>>>>
>>>> Best regards,
>>>> John
>>>>
>>>>
>>> Hi John,
>>>
>>> One way to do this would be to redefine the verbatim environment in
>>> LaTeX.  There is a fancyvrb package for LaTeX that might help with this.
>>>
>>> I think a better answer to your query has two parts.
>>
>> Thanks for the input!
>>
>>>
>>> 1) Make Org-mode distinguish your code and results, instead of having
>>> them both be verbatim environments.  One way to do this would be to use
>>> listings or minted to typeset the source code blocks: see
>>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12.
>>>
>>> Then use :wrap foo to wrap the results in a foo environment.
>>>
>>
>> So... foo could be verbatim or something like that shaded example in
>> the worg tutorial above? I'm thinking the code and results would still
>> be in different environments when the PDF is generated, right? You're
>> just suggesting that I put them in an environment that doesn't insert
>> so much white space?
>>
> You'll probably have to create a LaTeX environment that doesn't insert so
> much white space.  Best to do this with a new environment, rather than
> redefining one of the existing LaTeX environments, IMHO.
>
> The white space problem is something to correct at the LaTeX step, after
> Org-mode has wrapped the blocks in semantically meaningful environments.
>

I took a look at this and have managed to modify that example to tweak
the R blocks. How do I pick up the results, though? LaTeX is still
putting them in verbatim and I don't see how the listings package
could know what Org-mode babel is doing as it's not really "source
code" at that point in some sort of language?

Also, yes, I didn't have org-special-blocks enabled, hence it not
allowing me to create custom #+begin_... blocks.


Thanks!
John

> hth,
> Tom
>
>>> 2) Configure LaTeX to typeset the new environments in a way that pleases
>>> you. LaTeX specifies for each environment the space to leave before it
>>> and after it.  You should be able to set these so the results please
>>> you.  Here is one example for how to modify the results block:
>>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-2.
>>> Note that this was written for an earlier version of Org-mode, before
>>> results blocks were stored in drawers.  Instead of "results" use "foo".
>>>
>>
>> It will take me a while to figure all of this out. I don't know either
>> of these packages!
>>
>>> You'll need to consult the listings or minted packages to configure one
>>> of them.
>>>
>>> In effect, you will be taking advantage of LaTeX's semantic markup.
>>
>> Thanks again! I'll have a look into this this week.
>>
>> John
>>
>>>
>>> hth,
>>> Tom
>>> --
>>> Thomas S. Dye
>>> http://www.tsdye.com
>>
>
> --
> T.S. Dye & Colleagues, Archaeologists
> 735 Bishop St, Suite 315, Honolulu, HI 96813
> Tel: 808-529-0866, Fax: 808-529-0884
> http://www.tsdye.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Exporting via babel to LaTeX
  2012-05-29  2:33       ` John Hendy
@ 2012-05-29  3:29         ` Thomas S. Dye
  2012-05-29  3:46           ` John Hendy
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas S. Dye @ 2012-05-29  3:29 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

John Hendy <jw.hendy@gmail.com> writes:

> On Mon, May 28, 2012 at 6:35 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>> John Hendy <jw.hendy@gmail.com> writes:
>>
>>> On Mon, May 28, 2012 at 4:32 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>>>> John Hendy <jw.hendy@gmail.com> writes:
>>>>
>>>>> I've only ever used src blocks to make plots or create files to
>>>>> include. I have my first opportunity to actually try and include both
>>>>> code and results and have a question about spacing. You won't have my
>>>>> data, but this is pretty simple stuff.:
>>>>>
>>>>> #+begin_src R :session basic :results output :exports both
>>>>> nrow(data)
>>>>> #+end_src
>>>>> #+begin_src R :session basic :results output :exports both
>>>>> nrow(nonzero.data)
>>>>> #+end_src
>>>>>
>>>>> I split them up because I wanted the results like so:
>>>>>
>>>>> Code-A
>>>>> Results-A
>>>>> Code-B
>>>>> Results-B
>>>>>
>>>>> If I kept them together, it came out Code-A, Code-B, then Results-A, Results-B.
>>>>>
>>>>> Anyway, the LaTeX output is creating the following:
>>>>>
>>>>> \begin{verbatim}
>>>>> nrow(data)
>>>>> \end{verbatim}
>>>>>
>>>>> \begin{verbatim}
>>>>>  [1] 681
>>>>> \end{verbatim}
>>>>>
>>>>> \begin{verbatim}
>>>>> nrow(nonzero.data)
>>>>> \end{verbatim}
>>>>>
>>>>> \begin{verbatim}
>>>>>  [1] 455
>>>>> \end{verbatim}
>>>>>
>>>>> This gives really, really spaced out results. I'd prefer output that
>>>>> looks more like an R terminal output, which can be done by not putting
>>>>> code and results in separate verbatim blocks. Is this standard
>>>>> spacing/behavior or is there an option/exporter tweak I can use on
>>>>> this? It just ends up taking so much space.
>>>>>
>>>>> I'm super new to this and barely know anything about the header
>>>>> arguments at all. I will say I was thrilled to find out about the
>>>>> :session option. I was worried about "walking through code" because I
>>>>> rely on initial block results to carry through to the others. What do
>>>>> you know? There's a way to do that :) Thanks for this wonderful
>>>>> implementation. I've seen it come up on the list hundreds of time and
>>>>> have to say it's really cool actually getting to work with it!
>>>>>
>>>>>
>>>>> Best regards,
>>>>> John
>>>>>
>>>>>
>>>> Hi John,
>>>>
>>>> One way to do this would be to redefine the verbatim environment in
>>>> LaTeX.  There is a fancyvrb package for LaTeX that might help with this.
>>>>
>>>> I think a better answer to your query has two parts.
>>>
>>> Thanks for the input!
>>>
>>>>
>>>> 1) Make Org-mode distinguish your code and results, instead of having
>>>> them both be verbatim environments.  One way to do this would be to use
>>>> listings or minted to typeset the source code blocks: see
>>>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12.
>>>>
>>>> Then use :wrap foo to wrap the results in a foo environment.
>>>>
>>>
>>> So... foo could be verbatim or something like that shaded example in
>>> the worg tutorial above? I'm thinking the code and results would still
>>> be in different environments when the PDF is generated, right? You're
>>> just suggesting that I put them in an environment that doesn't insert
>>> so much white space?
>>>
>> You'll probably have to create a LaTeX environment that doesn't insert so
>> much white space.  Best to do this with a new environment, rather than
>> redefining one of the existing LaTeX environments, IMHO.
>>
>> The white space problem is something to correct at the LaTeX step, after
>> Org-mode has wrapped the blocks in semantically meaningful environments.
>>
>
> I took a look at this and have managed to modify that example to tweak
> the R blocks. How do I pick up the results, though? LaTeX is still
> putting them in verbatim and I don't see how the listings package
> could know what Org-mode babel is doing as it's not really "source
> code" at that point in some sort of language?
>
> Also, yes, I didn't have org-special-blocks enabled, hence it not
> allowing me to create custom #+begin_... blocks.
>
>
> Thanks!
> John
>
Hi John,

Yes, you're right, listings won't touch the results.  To have Org-mode
put the results in an environment of your choosing, do this (note the
:wrap keyword):

#+begin_src R :session basic :results output :exports both :wrap foo
  nrow(nonzero.data)
#+end_src

This should give you 
#+BEGIN_foo
...
#+END_foo

If you also have lines like this, then you should see something in the
pdf file.

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

All the best,
Tom

>> hth,
>> Tom
>>
>>>> 2) Configure LaTeX to typeset the new environments in a way that pleases
>>>> you. LaTeX specifies for each environment the space to leave before it
>>>> and after it.  You should be able to set these so the results please
>>>> you.  Here is one example for how to modify the results block:
>>>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-2.
>>>> Note that this was written for an earlier version of Org-mode, before
>>>> results blocks were stored in drawers.  Instead of "results" use "foo".
>>>>
>>>
>>> It will take me a while to figure all of this out. I don't know either
>>> of these packages!
>>>
>>>> You'll need to consult the listings or minted packages to configure one
>>>> of them.
>>>>
>>>> In effect, you will be taking advantage of LaTeX's semantic markup.
>>>
>>> Thanks again! I'll have a look into this this week.
>>>
>>> John
>>>
>>>>
>>>> hth,
>>>> Tom
>>>> --
>>>> Thomas S. Dye
>>>> http://www.tsdye.com
>>>
>>
>> --
>> T.S. Dye & Colleagues, Archaeologists
>> 735 Bishop St, Suite 315, Honolulu, HI 96813
>> Tel: 808-529-0866, Fax: 808-529-0884
>> http://www.tsdye.com

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Exporting via babel to LaTeX
  2012-05-29  3:29         ` Thomas S. Dye
@ 2012-05-29  3:46           ` John Hendy
  2012-05-29  4:53             ` Thomas S. Dye
  0 siblings, 1 reply; 11+ messages in thread
From: John Hendy @ 2012-05-29  3:46 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

On Mon, May 28, 2012 at 10:29 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
> John Hendy <jw.hendy@gmail.com> writes:
>
>> On Mon, May 28, 2012 at 6:35 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>>> John Hendy <jw.hendy@gmail.com> writes:
>>>
>>>> On Mon, May 28, 2012 at 4:32 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>>>>> John Hendy <jw.hendy@gmail.com> writes:
>>>>>
>>>>>> I've only ever used src blocks to make plots or create files to
>>>>>> include. I have my first opportunity to actually try and include both
>>>>>> code and results and have a question about spacing. You won't have my
>>>>>> data, but this is pretty simple stuff.:
>>>>>>
>>>>>> #+begin_src R :session basic :results output :exports both
>>>>>> nrow(data)
>>>>>> #+end_src
>>>>>> #+begin_src R :session basic :results output :exports both
>>>>>> nrow(nonzero.data)
>>>>>> #+end_src
>>>>>>
>>>>>> I split them up because I wanted the results like so:
>>>>>>
>>>>>> Code-A
>>>>>> Results-A
>>>>>> Code-B
>>>>>> Results-B
>>>>>>
>>>>>> If I kept them together, it came out Code-A, Code-B, then Results-A, Results-B.
>>>>>>
>>>>>> Anyway, the LaTeX output is creating the following:
>>>>>>
>>>>>> \begin{verbatim}
>>>>>> nrow(data)
>>>>>> \end{verbatim}
>>>>>>
>>>>>> \begin{verbatim}
>>>>>>  [1] 681
>>>>>> \end{verbatim}
>>>>>>
>>>>>> \begin{verbatim}
>>>>>> nrow(nonzero.data)
>>>>>> \end{verbatim}
>>>>>>
>>>>>> \begin{verbatim}
>>>>>>  [1] 455
>>>>>> \end{verbatim}
>>>>>>
>>>>>> This gives really, really spaced out results. I'd prefer output that
>>>>>> looks more like an R terminal output, which can be done by not putting
>>>>>> code and results in separate verbatim blocks. Is this standard
>>>>>> spacing/behavior or is there an option/exporter tweak I can use on
>>>>>> this? It just ends up taking so much space.
>>>>>>
>>>>>> I'm super new to this and barely know anything about the header
>>>>>> arguments at all. I will say I was thrilled to find out about the
>>>>>> :session option. I was worried about "walking through code" because I
>>>>>> rely on initial block results to carry through to the others. What do
>>>>>> you know? There's a way to do that :) Thanks for this wonderful
>>>>>> implementation. I've seen it come up on the list hundreds of time and
>>>>>> have to say it's really cool actually getting to work with it!
>>>>>>
>>>>>>
>>>>>> Best regards,
>>>>>> John
>>>>>>
>>>>>>
>>>>> Hi John,
>>>>>
>>>>> One way to do this would be to redefine the verbatim environment in
>>>>> LaTeX.  There is a fancyvrb package for LaTeX that might help with this.
>>>>>
>>>>> I think a better answer to your query has two parts.
>>>>
>>>> Thanks for the input!
>>>>
>>>>>
>>>>> 1) Make Org-mode distinguish your code and results, instead of having
>>>>> them both be verbatim environments.  One way to do this would be to use
>>>>> listings or minted to typeset the source code blocks: see
>>>>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12.
>>>>>
>>>>> Then use :wrap foo to wrap the results in a foo environment.
>>>>>
>>>>
>>>> So... foo could be verbatim or something like that shaded example in
>>>> the worg tutorial above? I'm thinking the code and results would still
>>>> be in different environments when the PDF is generated, right? You're
>>>> just suggesting that I put them in an environment that doesn't insert
>>>> so much white space?
>>>>
>>> You'll probably have to create a LaTeX environment that doesn't insert so
>>> much white space.  Best to do this with a new environment, rather than
>>> redefining one of the existing LaTeX environments, IMHO.
>>>
>>> The white space problem is something to correct at the LaTeX step, after
>>> Org-mode has wrapped the blocks in semantically meaningful environments.
>>>
>>
>> I took a look at this and have managed to modify that example to tweak
>> the R blocks. How do I pick up the results, though? LaTeX is still
>> putting them in verbatim and I don't see how the listings package
>> could know what Org-mode babel is doing as it's not really "source
>> code" at that point in some sort of language?
>>
>> Also, yes, I didn't have org-special-blocks enabled, hence it not
>> allowing me to create custom #+begin_... blocks.
>>
>>
>> Thanks!
>> John
>>
> Hi John,
>
> Yes, you're right, listings won't touch the results.  To have Org-mode
> put the results in an environment of your choosing, do this (note the
> :wrap keyword):
>
> #+begin_src R :session basic :results output :exports both :wrap foo
>  nrow(nonzero.data)
> #+end_src
>
> This should give you
> #+BEGIN_foo
> ...
> #+END_foo
>
> If you also have lines like this, then you should see something in the
> pdf file.
>
> #+LaTeX_HEADER: \usepackage{framed}
> #+LaTeX_HEADER: \usepackage{xcolor}
> #+LaTeX_HEADER: \definecolor{shadecolor}{gray}{.95}
> #+LaTeX_HEADER: \newenvironment{foo}{\begin{shaded}}{\end{shaded}}
>

Ahhh. Now I get it. That's brilliant! Why can't we just have =:wrap
foo= apply to the source blocks as well? That would solve all my
problems :) For a simple tweak, it seems much easier to have universal
syntax like :wrap vs. having to define language specific
listings/minting options to make this work.

On the other hand, I think I get the benefit listings/minting have for
those who do this a lot more than me. Set it once, then forget it. For
someone who just likes to tweak the look of all source blocks
though... a :wrap argument would be fantastic -- set it on a
per-document basis in Org and you're set.

Sincere thanks for your explanations and assistance!


John


> All the best,
> Tom
>
>>> hth,
>>> Tom
>>>
>>>>> 2) Configure LaTeX to typeset the new environments in a way that pleases
>>>>> you. LaTeX specifies for each environment the space to leave before it
>>>>> and after it.  You should be able to set these so the results please
>>>>> you.  Here is one example for how to modify the results block:
>>>>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-2.
>>>>> Note that this was written for an earlier version of Org-mode, before
>>>>> results blocks were stored in drawers.  Instead of "results" use "foo".
>>>>>
>>>>
>>>> It will take me a while to figure all of this out. I don't know either
>>>> of these packages!
>>>>
>>>>> You'll need to consult the listings or minted packages to configure one
>>>>> of them.
>>>>>
>>>>> In effect, you will be taking advantage of LaTeX's semantic markup.
>>>>
>>>> Thanks again! I'll have a look into this this week.
>>>>
>>>> John
>>>>
>>>>>
>>>>> hth,
>>>>> Tom
>>>>> --
>>>>> Thomas S. Dye
>>>>> http://www.tsdye.com
>>>>
>>>
>>> --
>>> T.S. Dye & Colleagues, Archaeologists
>>> 735 Bishop St, Suite 315, Honolulu, HI 96813
>>> Tel: 808-529-0866, Fax: 808-529-0884
>>> http://www.tsdye.com
>
> --
> T.S. Dye & Colleagues, Archaeologists
> 735 Bishop St, Suite 315, Honolulu, HI 96813
> Tel: 808-529-0866, Fax: 808-529-0884
> http://www.tsdye.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Exporting via babel to LaTeX
  2012-05-29  3:46           ` John Hendy
@ 2012-05-29  4:53             ` Thomas S. Dye
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas S. Dye @ 2012-05-29  4:53 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

John Hendy <jw.hendy@gmail.com> writes:

> On Mon, May 28, 2012 at 10:29 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>> John Hendy <jw.hendy@gmail.com> writes:
>>
>>> On Mon, May 28, 2012 at 6:35 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>>>> John Hendy <jw.hendy@gmail.com> writes:
>>>>
>>>>> On Mon, May 28, 2012 at 4:32 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>>>>>> John Hendy <jw.hendy@gmail.com> writes:
>>>>>>
>>>>>>> I've only ever used src blocks to make plots or create files to
>>>>>>> include. I have my first opportunity to actually try and include both
>>>>>>> code and results and have a question about spacing. You won't have my
>>>>>>> data, but this is pretty simple stuff.:
>>>>>>>
>>>>>>> #+begin_src R :session basic :results output :exports both
>>>>>>> nrow(data)
>>>>>>> #+end_src
>>>>>>> #+begin_src R :session basic :results output :exports both
>>>>>>> nrow(nonzero.data)
>>>>>>> #+end_src
>>>>>>>
>>>>>>> I split them up because I wanted the results like so:
>>>>>>>
>>>>>>> Code-A
>>>>>>> Results-A
>>>>>>> Code-B
>>>>>>> Results-B
>>>>>>>
>>>>>>> If I kept them together, it came out Code-A, Code-B, then Results-A, Results-B.
>>>>>>>
>>>>>>> Anyway, the LaTeX output is creating the following:
>>>>>>>
>>>>>>> \begin{verbatim}
>>>>>>> nrow(data)
>>>>>>> \end{verbatim}
>>>>>>>
>>>>>>> \begin{verbatim}
>>>>>>>  [1] 681
>>>>>>> \end{verbatim}
>>>>>>>
>>>>>>> \begin{verbatim}
>>>>>>> nrow(nonzero.data)
>>>>>>> \end{verbatim}
>>>>>>>
>>>>>>> \begin{verbatim}
>>>>>>>  [1] 455
>>>>>>> \end{verbatim}
>>>>>>>
>>>>>>> This gives really, really spaced out results. I'd prefer output that
>>>>>>> looks more like an R terminal output, which can be done by not putting
>>>>>>> code and results in separate verbatim blocks. Is this standard
>>>>>>> spacing/behavior or is there an option/exporter tweak I can use on
>>>>>>> this? It just ends up taking so much space.
>>>>>>>
>>>>>>> I'm super new to this and barely know anything about the header
>>>>>>> arguments at all. I will say I was thrilled to find out about the
>>>>>>> :session option. I was worried about "walking through code" because I
>>>>>>> rely on initial block results to carry through to the others. What do
>>>>>>> you know? There's a way to do that :) Thanks for this wonderful
>>>>>>> implementation. I've seen it come up on the list hundreds of time and
>>>>>>> have to say it's really cool actually getting to work with it!
>>>>>>>
>>>>>>>
>>>>>>> Best regards,
>>>>>>> John
>>>>>>>
>>>>>>>
>>>>>> Hi John,
>>>>>>
>>>>>> One way to do this would be to redefine the verbatim environment in
>>>>>> LaTeX.  There is a fancyvrb package for LaTeX that might help with this.
>>>>>>
>>>>>> I think a better answer to your query has two parts.
>>>>>
>>>>> Thanks for the input!
>>>>>
>>>>>>
>>>>>> 1) Make Org-mode distinguish your code and results, instead of having
>>>>>> them both be verbatim environments.  One way to do this would be to use
>>>>>> listings or minted to typeset the source code blocks: see
>>>>>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12.
>>>>>>
>>>>>> Then use :wrap foo to wrap the results in a foo environment.
>>>>>>
>>>>>
>>>>> So... foo could be verbatim or something like that shaded example in
>>>>> the worg tutorial above? I'm thinking the code and results would still
>>>>> be in different environments when the PDF is generated, right? You're
>>>>> just suggesting that I put them in an environment that doesn't insert
>>>>> so much white space?
>>>>>
>>>> You'll probably have to create a LaTeX environment that doesn't insert so
>>>> much white space.  Best to do this with a new environment, rather than
>>>> redefining one of the existing LaTeX environments, IMHO.
>>>>
>>>> The white space problem is something to correct at the LaTeX step, after
>>>> Org-mode has wrapped the blocks in semantically meaningful environments.
>>>>
>>>
>>> I took a look at this and have managed to modify that example to tweak
>>> the R blocks. How do I pick up the results, though? LaTeX is still
>>> putting them in verbatim and I don't see how the listings package
>>> could know what Org-mode babel is doing as it's not really "source
>>> code" at that point in some sort of language?
>>>
>>> Also, yes, I didn't have org-special-blocks enabled, hence it not
>>> allowing me to create custom #+begin_... blocks.
>>>
>>>
>>> Thanks!
>>> John
>>>
>> Hi John,
>>
>> Yes, you're right, listings won't touch the results.  To have Org-mode
>> put the results in an environment of your choosing, do this (note the
>> :wrap keyword):
>>
>> #+begin_src R :session basic :results output :exports both :wrap foo
>>  nrow(nonzero.data)
>> #+end_src
>>
>> This should give you
>> #+BEGIN_foo
>> ...
>> #+END_foo
>>
>> If you also have lines like this, then you should see something in the
>> pdf file.
>>
>> #+LaTeX_HEADER: \usepackage{framed}
>> #+LaTeX_HEADER: \usepackage{xcolor}
>> #+LaTeX_HEADER: \definecolor{shadecolor}{gray}{.95}
>> #+LaTeX_HEADER: \newenvironment{foo}{\begin{shaded}}{\end{shaded}}
>>
>
> Ahhh. Now I get it. That's brilliant! Why can't we just have =:wrap
> foo= apply to the source blocks as well? That would solve all my
> problems :) For a simple tweak, it seems much easier to have universal
> syntax like :wrap vs. having to define language specific
> listings/minting options to make this work.
>
> On the other hand, I think I get the benefit listings/minting have for
> those who do this a lot more than me. Set it once, then forget it. For
> someone who just likes to tweak the look of all source blocks
> though... a :wrap argument would be fantastic -- set it on a
> per-document basis in Org and you're set.
>
> Sincere thanks for your explanations and assistance!
>
>
> John
>
>
Hi John,

Glad it's working for you.  Minted and listings are neat because they
parse the source code and do semantic markup.  Once you set up one, it
should just work.

Good luck with the LaTeX part.

All the best,
Tom

>> All the best,
>> Tom
>>
>>>> hth,
>>>> Tom
>>>>
>>>>>> 2) Configure LaTeX to typeset the new environments in a way that pleases
>>>>>> you. LaTeX specifies for each environment the space to leave before it
>>>>>> and after it.  You should be able to set these so the results please
>>>>>> you.  Here is one example for how to modify the results block:
>>>>>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-2.
>>>>>> Note that this was written for an earlier version of Org-mode, before
>>>>>> results blocks were stored in drawers.  Instead of "results" use "foo".
>>>>>>
>>>>>
>>>>> It will take me a while to figure all of this out. I don't know either
>>>>> of these packages!
>>>>>
>>>>>> You'll need to consult the listings or minted packages to configure one
>>>>>> of them.
>>>>>>
>>>>>> In effect, you will be taking advantage of LaTeX's semantic markup.
>>>>>
>>>>> Thanks again! I'll have a look into this this week.
>>>>>
>>>>> John
>>>>>
>>>>>>
>>>>>> hth,
>>>>>> Tom
>>>>>> --
>>>>>> Thomas S. Dye
>>>>>> http://www.tsdye.com
>>>>>
>>>>
>>>> --
>>>> T.S. Dye & Colleagues, Archaeologists
>>>> 735 Bishop St, Suite 315, Honolulu, HI 96813
>>>> Tel: 808-529-0866, Fax: 808-529-0884
>>>> http://www.tsdye.com
>>
>> --
>> T.S. Dye & Colleagues, Archaeologists
>> 735 Bishop St, Suite 315, Honolulu, HI 96813
>> Tel: 808-529-0866, Fax: 808-529-0884
>> http://www.tsdye.com

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-05-29  4:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-28 18:48 Exporting via babel to LaTeX John Hendy
2012-05-28 18:56 ` Achim Gratz
2012-05-28 21:32 ` Thomas S. Dye
2012-05-28 23:02   ` John Hendy
2012-05-28 23:35     ` Thomas S. Dye
2012-05-29  2:33       ` John Hendy
2012-05-29  3:29         ` Thomas S. Dye
2012-05-29  3:46           ` John Hendy
2012-05-29  4:53             ` Thomas S. Dye
2012-05-28 23:10   ` John Hendy
2012-05-28 23:30     ` Thomas S. Dye

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).