Re: [O] Enabling another language in org-babel

2014-06-24 Thread G. Jay Kerns
Great work, Ista!

Cheers,
Jay

-- 
G. Jay Kerns, Ph.D.
Youngstown State University
http://gkerns.people.ysu.edu/


On 06/24/14 15:52, Ista Zahn wrote:
 I just hacked up a rudimentary ob-stata.el by replacing julia with
 stata in ob-julia.el by G. Jay Kerns (and making a few other minor
 tweaks). Only :results output works (no graphics, no :results
 value). In short it's in pretty rough shape, but it does work for some
 basic things. Perhaps someone with better emacs-lisp can polish it up.
 The code is available at
 https://gist.github.com/izahn/5745dcf6dd07a6b05084
 
 Best,
 Ista
 
 On Tue, Jun 24, 2014 at 8:05 AM, Rainer M Krug rai...@krugs.de wrote:
 Eric Schulte schulte.e...@gmail.com writes:

 Brendan Halpin brendan.hal...@ul.ie writes:

 Does there exist any documentation on extending org-babel to another
 language?


 Hi Brendan,

 There is a template [1] which may be filled out to add support for a new
 language.  More generally simply defining a function named
 `org-babel-execute:foo' will cause babel to try to execute foo code
 blocks using that function.  See the template for existing
 `org-babel-execute:*' functions.


 Relatedly, is anyone working on adding Stata coverage to org-babel?


 I'm not but who knows.  If you do add support for Stata please consider
 contributing it to Org-mode (see [2]).

 stata should be not to difficult to add, as ESS supports stata and I
 would guess that most functions would be the same (or very similar)

 Cheers,

 Rainer


 Best,
 Eric



 Regards,

 Brendan


 Footnotes:
 [1]  
 http://orgmode.org/w/worg.git/blob/HEAD:/org-contrib/babel/ob-template.el

 [2]  http://orgmode.org/worg/org-contribute.html

 --
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
 UCT), Dipl. Phys. (Germany)

 Centre of Excellence for Invasion Biology
 Stellenbosch University
 South Africa

 Tel :   +33 - (0)9 53 10 27 44
 Cell:   +33 - (0)6 85 62 59 98
 Fax :   +33 - (0)9 58 10 27 44

 Fax (D):+49 - (0)3 21 21 25 22 44

 email:  rai...@krugs.de

 Skype:  RMkrug

 PGP: 0x0F52F982



Re: [O] Formatting R output

2012-09-10 Thread G. Jay Kerns
Dear Erich,

comments inline below.

 From: Neuwirth Erich erich.neuwirth at univie.ac.at
 Subject: Formatting R output
 Newsgroups: gmane.emacs.orgmode
 Date: 2012-09-10 12:12:00 GMT

 I am using org-mode with R.
 I already wrote a message about formatting inline code some time ago.
 After working more with R in org-mode (which I _really_ like) I have some
 questions and/or suggestions.

 1) a mild annoyance.

 src_R{1+1} inserts the result 2 in the output. In fact, it inserts =2=.
 When one runs the file repeatedly, org-mode does not remove older results.
 So if I replace src_R{1+1} by src_R{2+2} and do not remove the last output,
 My file will contain

 src_R{2+2} =4= =2=

 Also, If I run the inline code segment by C-c C-c one, the org file ail 
 contain just 1
 correct result, bit if afterwards I export the file (to LaTeX or html),
 the exported file will have 2 copies of the result.

 Is there anything the developers can do about this?

I can confirm that if a person does not remove old output but changes
input to the inline code segment then the exported file will have both
the correct output plus the (old) incorrect output.  My strategy to
avoid this is use C-c C-c sparingly just to check whether the output
is as expected, then always erase output.  If I am going to use an org
file with C-c C-c a lot (for a lecture, say), then I keep a copy for
exporting clean and separate from the one I am going to do a lot of
C-c C-c'ing with.  YMMV.


 2) formatting inline output.
 As discussed above, using inline code produces something like
 src_R{2+2} =4=

 In some cases, I would like the result to be not on fixed font.
 Currently, I to not see a way of removing the equal signs before and after 
 the result,
 they seem to be added by org itself, therefore I cannot use trickery in R to 
 remove them.
 Could the developers think of an option which would allow to get the result
 without the bracketing equal signs?

I think you can fix this with inline code-segment header arguments
which will override buffer-wide or system wide settings.  So, for
example, you could do

src_R[:results raw]{2 + 2}

which will return 4 and not =4=.

I hope this helps,
Jay


-- 


*
G. Jay Kerns, Ph.D.
Associate Professor
Mathematics and Statistics
http://people.ysu.edu/~gkerns/



Re: [O] how to both :body-only t and :table-of-contents t

2011-09-23 Thread G. Jay Kerns
Dear Jan

On Fri, Sep 23, 2011 at 3:51 AM, Jan Böcker jan.boec...@jboecker.de wrote:


 Hi Jay,

 I faced the same problem about a year ago.
 See this thread in the mailing list archive:

 http://thread.gmane.org/gmane.emacs.orgmode/24227

 The HTML exporter will refuse to include a TOC if body-only is t; the
 atom exporter and a send HTML messages with Wanderlust hack relied on
 that behaviour, which is why this was not changed in the official Org
 repository.

 You can either apply the one-line patch I included in the linked thread
 or ask Ian Barton about his solution using jQuery he mentioned at the
 end of that thread.

 HTH,
  Jan


Thanks; I was afraid it was going to be something like that, and am
appreciative that I don't need to reinvent this particular wheel.  My
previous workaround was to export once with TOC, copy-paste the TOC
bit to the org-file in a #+BEGIN_HTML block, then export again with
:body-only t.  But each run takes a couple of hours (another question
for another day), which is a pain, and not convenient should the
document structure change.

I noticed in the thread that Carsten mentioned writing a hook that
strips the other stuff.  Don't have much experience writing hooks, but
there should be a way to write a custom publishing function just like
the current one which strips everything but the TOC.  I'll use your
patch while I continue thinking about it.

Thanks again.
Jay



[O] how to both :body-only t and :table-of-contents t

2011-09-21 Thread G. Jay Kerns
Dear Org Mode list,

First: congratulations on Org mode; it is truly dynamite.

I am publishing a project to HTML for the purposes of Jekyll
post-processing.  For this, I need to set :body-only t so I can put
the YAML frontmatter at the top of my file.  However, I would also
like to have the TOC exported (only), right after the body tag,
which it correctly does whenever :body-only isn't t.

In other words, it looks like I am obliged to :body-only t which cuts
out header/footer/TOC or I can NOT do :body-only t which will give me
the TOC plus a bunch of extra stuff.

My question:  is it possible to do what I want?  Is there some sort of
YAML {{ page.toc }} that I'm missing somewhere, or is there some
combination of publishing options that I've missed that will export an
org file to an HTML file that looks like this:

---
layout: default
title: whatever
---

div id=table-of-contents
h2Table of Contents/h2
div id=text-table-of-contents
ul
lia href=#sec-1blah blah blah /a/li
lia href=#sec-2blah blah blah /a/li
/ul
/div
/div

Rest of exported content here?

Thanks for any advice, and again, THANK YOU to the Org Mode team.

Best,
Jay