emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Douglas Bates <bates@stat.wisc.edu>
To: emacs-orgmode@gnu.org
Subject: Re: [babel] configuring LaTeX exports verbatim environment for exported code and results
Date: Tue, 31 Aug 2010 08:28:19 -0500	[thread overview]
Message-ID: <AANLkTikO+3dSB3FJf7dV+bvnKX3XTuzw8b1ARBAewG=S@mail.gmail.com> (raw)
In-Reply-To: <AANLkTik2v0Cm-X4XoaUWyN5L3NVr5UD0D+_=ZicHbzWU@mail.gmail.com>

On Tue, Aug 31, 2010 at 8:08 AM, Douglas Bates <bates@stat.wisc.edu> wrote:
> I have been unable to find in the documentation whether the verbatim
> environment created by LaTeX exports of source code blocks can be
> configured.
>
> Exporting to LaTeX a section like
>
> --8<---------------cut here---------------start------------->8---
> #+LaTeX_CLASS: beamer
> #+LaTeX_CLASS_OPTIONS: [presentation]
> #+BEAMER_FRAME_LEVEL: 1
> #+BABEL: :session :exports both :results output :tangle yes
>
> * Fitting a simple linear regression
> #+begin_src R :exports results
> options(show.signif.stars=FALSE)
> #+end_src
> #+begin_src R
> summary(fm1 <- lm(optden ~ carb, Formaldehyde))
> #+end_src
> A final line.
> --8<---------------cut here---------------end--------------->8---
>
> produces the LaTeX section
>
> --8<---------------cut here---------------start------------->8---
> \begin{frame}[fragile]
> \frametitle{Fitting a simple linear regression}
> \label{sec-1}
>
> \begin{verbatim}
> summary(fm1 <- lm(optden ~ carb, Formaldehyde))
> \end{verbatim}
>
>
>
> \begin{verbatim}
>
> Call:
> lm(formula = optden ~ carb, data = Formaldehyde)
>
> Residuals:
>        1         2         3         4         5         6
> -0.006714  0.001029  0.002771  0.007143  0.007514 -0.011743
>
> Coefficients:
>            Estimate Std. Error t value Pr(>|t|)
> (Intercept) 0.005086   0.007834   0.649    0.552
> carb        0.876286   0.013535  64.744 3.41e-07
>
> Residual standard error: 0.008649 on 4 degrees of freedom
> Multiple R-squared: 0.999,      Adjusted R-squared: 0.9988
> F-statistic:  4192 on 1 and 4 DF,  p-value: 3.409e-07
> \end{verbatim}
>
> A final line.
> \end{frame}
> --8<---------------cut here---------------end--------------->8---
>
> Because both the source and the results are presented in verbatim, I
> don't have much control over the appearance of the code on the slide.
> If I could, for example, configure the names of the exported
> environment for the source code and for the results separately, I
> could use LaTeX's fancyvrb.sty to adjust font sizes, colors, boxes,
> etc.

I just realized that if the code and results are wrapped in other than
the verbatim environment the org-beamer-fragile-re variable will need
to be customized.  (By the way, automatically detecting the need for
the fragile option is a great idea.)

> Also, the blank lines before and after the verbatim environment are
> problematic.  In plain text it makes sense to delimit code chunks with
> blank lines but in LaTeX a blank line starts a new paragraph and you
> don't always want that.
>
> As this is my first posting please let me know if I have inadvertently
> violated conventions of the list.

Well, other than my cut-and-paste glich below :-/
>
> Also, the exports append blank lines
>

  reply	other threads:[~2010-08-31 13:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31 13:08 [babel] configuring LaTeX exports verbatim environment for exported code and results Douglas Bates
2010-08-31 13:28 ` Douglas Bates [this message]
2010-08-31 14:40   ` Eric Schulte

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='AANLkTikO+3dSB3FJf7dV+bvnKX3XTuzw8b1ARBAewG=S@mail.gmail.com' \
    --to=bates@stat.wisc.edu \
    --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).