Aloha Mike,

It looks like your source block and results are indented.  IIRC, that's
not a good thing.

This might work better:

#+name: gauland-eg
#+HEADER: :results output raw
#+HEADER: :exports results
#+BEGIN_SRC R
  library(xtable)
  library(ascii)
  print(ascii(xtable(matrix(c(1,2,3,4),nrow=2,ncol=2))),type="org")
#+END_SRC

#+results: gauland-eg
|   |    1 |    2 |
|---+------+------|
| 1 | 1.00 | 3.00 |
| 2 | 2.00 | 4.00 |

Then you can let the new exporter do the work of making the LaTeX export
look nice. This has the (possible) advantage that it also exports to the
other back ends, not just LaTeX.

hth,
Tom

Michael Gauland <mikely...@no8wireless.co.nz> writes:

> I use the xtables package in R to generate nice-looking tables for LaTeX 
> output,
> as in the snippet below. The new exporter escapes the % symbol in the R 
> output,
> so that the comments generated by xtable are no longer comments. 
>
> * Snippet
>   #+HEADER: :results output latex
>   #+HEADER: :exports results
>   #+BEGIN_SRC R
>   library(xtable)
>   xtable(matrix(c(1,2,3,4),nrow=2,ncol=2))
>   #+END_SRC
>
>   #+RESULTS:
>   #+BEGIN_LaTeX
>   % latex table generated in R 2.15.1 by xtable 1.7-0 package
>   % Thu Oct 25 13:11:30 2012
>   \begin{table}[ht]
>   \begin{center}
>   \begin{tabular}{rrr}
>     \hline
>    & 1 & 2 \\ 
>     \hline
>   1 & 1.00 & 3.00 \\ 
>     2 & 2.00 & 4.00 \\ 
>      \hline
>   \end{tabular}
>   \end{center}
>   \end{table}
>   #+END_LaTeX

-- 
Thomas S. Dye
http://www.tsdye.com

Reply via email to