* hlines in babel output
@ 2013-02-11 1:34 Rasmus
2013-02-23 21:23 ` Rasmus
0 siblings, 1 reply; 3+ messages in thread
From: Rasmus @ 2013-02-11 1:34 UTC (permalink / raw
To: emacs-orgmode
Hi,
I have the following Org document where I would like to add some extra
hlines to the output. I'm using babel. I tried the ascii package but
couldn't find anything giving me extra hlines. I'd also prefer to
stick to just babel.
Here's the example:
#+begin_src org
#+TITLE:hline test
* Some R code
I have the following R code and I want to add hlines to the final
output since it is exported and needs to look good. In particular,
it is desired that the last line is separated with an hline.
I could do it by exporting directly to LaTeX, but I would rather
export to an Org table.
#+NAME:budget-dta
#+begin_src R :colnames yes
tt <- textConnection("
account p
rent 110
food 50")
ee <- read.table(tt, header = TRUE)
close(tt)
cc <- 4 ## a complicated number generated with R
ee$p <- ee$p * cc
ee <- rbind(ee, data.frame(p=sum(ee$p),account=c("total")))
ee
#+end_src
* Actual output:
#+RESULTS: budget-dta
| account | p |
|---------+-----|
| rent | 440 |
| food | 200 |
| total | 640 |
* Minimally desired output
| account | p |
|---------+-----|
| rent | 440 |
| food | 200 |
|---------+-----|
| total | 640 |
* Most desired output
|---------+-----|
| account | p |
|---------+-----|
| rent | 440 |
| food | 200 |
|---------+-----|
| total | 640 |
|---------+-----|
#+end_src
--
. . . The proofs are technical in nature and provides no real understanding.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: hlines in babel output
2013-02-11 1:34 hlines in babel output Rasmus
@ 2013-02-23 21:23 ` Rasmus
2013-02-23 21:38 ` Eric Schulte
0 siblings, 1 reply; 3+ messages in thread
From: Rasmus @ 2013-02-23 21:23 UTC (permalink / raw
To: emacs-orgmode
> I have the following Org document where I would like to add some extra
> hlines to the output. I'm using babel. I tried the ascii package but
> couldn't find anything giving me extra hlines. I'd also prefer to
> stick to just babel.
I'm still looking for a good way to insert horizontal lines into
generated tables. I have been trying to use Emacs Lisp to use
org-table-insert-hline using (i) babel and (ii) noweb. For (i) I need
to add an hline object as the second-to-last object, but I havne't
been successful so far.
I'd appreciate any hints.
#+NAME:budget-dta
#+begin_src R :colnames yes :noweb-ref TBL :exports none
tt <- textConnection("
account p
rent 110
food 50")
ee <- read.table(tt, header = TRUE)
close(tt)
cc <- 4 ## a complicated number generated with R
ee$p <- ee$p * cc
ee <- rbind(ee, data.frame(p=sum(ee$p),account=c("total")))
ee
#+end_src
#+NAME:test
#+RESULTS: budget-dta
| account | p |
|---------+-----|
| rent | 440 |
| food | 200 |
| total | 640 |
#+BEGIN_SRC emacs-lisp :var X=test
(add-to-list 'X 'hline t)
#+END_SRC
--
Vote for proprietary math!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: hlines in babel output
2013-02-23 21:23 ` Rasmus
@ 2013-02-23 21:38 ` Eric Schulte
0 siblings, 0 replies; 3+ messages in thread
From: Eric Schulte @ 2013-02-23 21:38 UTC (permalink / raw
To: Rasmus; +Cc: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
>> I have the following Org document where I would like to add some extra
>> hlines to the output. I'm using babel. I tried the ascii package but
>> couldn't find anything giving me extra hlines. I'd also prefer to
>> stick to just babel.
>
> I'm still looking for a good way to insert horizontal lines into
> generated tables. I have been trying to use Emacs Lisp to use
> org-table-insert-hline using (i) babel and (ii) noweb. For (i) I need
> to add an hline object as the second-to-last object, but I havne't
> been successful so far.
>
> I'd appreciate any hints.
>
First be sure to read the relevant page of the manual [1]. After that,
something like the following should allow for arbitrary hline insertion.
#+name: test
#+begin_src sh
seq 10
#+end_src
#+begin_src emacs-lisp :var x=test
(append (subseq x 0 2) (list 'hline) (subseq x 2))
#+end_src
#+RESULTS:
| 1 |
| 2 |
|----|
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
Hope this helps,
Footnotes:
[1] http://orgmode.org/manual/hlines.html
--
Eric Schulte
http://cs.unm.edu/~eschulte
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-23 21:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-11 1:34 hlines in babel output Rasmus
2013-02-23 21:23 ` Rasmus
2013-02-23 21:38 ` Eric Schulte
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.