ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Johan Sandblom" <jsandblom@gmail.com>
Subject: Writing a ConTeXt module for R
Date: Tue, 6 Jun 2006 20:00:19 +0200	[thread overview]
Message-ID: <97a06f070606061100o2cd059bawa46a56d19e9f7c7@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1465 bytes --]

Since I sometimes use the open-source statistics environment R
(http://www.r-project.org) as well as ConTeXt, I thought a module that
could typeset R code as well as evaluate it on the fly would be
useful. Borrowing largely without understanding but lots of trial and
eror from m-gnustep.tex, I came up with the attached. Limited testing
indicates it works, but at least one problem is apparent: the R code
snippets have one unnecessary line break to start them and two after
the end. How can I fix that? Of course, any other suggestions are also
welcome.

A recent R needs to be in the path, but given that, it seems to work
on Windows XP as well as Linux.

Regards, Johan

PS Emacs users may appreciate the following to get r-mode where appropriate:
(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
(setq mmm-submode-decoration-level 2)
(mmm-add-group
 'context-plus
 '((context-MP
    :submode metapost-mode
    :face mmm-code-submode-face
    :front ".*\\\\start\\w*MP\\w*\\({\\w*}\\|\\[\\w*\\]\\|\\)\\W"
    :back  ".*\\\\stop\\w*MP")
   (context-R
    :submode r-mode
    :face mmm-comment-submode-face
    :front ".*\\\\startR.*\\W"
    :back  ".*\\\\stopR.*")))
(add-to-list
 'mmm-mode-ext-classes-alist '(context-mode nil context-plus))

-- 
Johan Sandblom  N8, MRC, Karolinska sjh
t +46851776108  17176 Stockholm
m +46735521477  Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell

[-- Attachment #2: t-rweave.tex --]
[-- Type: application/x-tex, Size: 2337 bytes --]

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

             reply	other threads:[~2006-06-06 18:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-06 18:00 Johan Sandblom [this message]
2006-06-06 19:30 ` Johan Sandblom
2006-06-07  8:07   ` Taco Hoekwater
2006-06-07 10:00     ` Johan Sandblom

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97a06f070606061100o2cd059bawa46a56d19e9f7c7@mail.gmail.com \
    --to=jsandblom@gmail.com \
    --cc=johan.sandblom@ki.se \
    --cc=ntg-context@ntg.nl \
    /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.
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 NNTP newsgroup(s).