emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [new exporter]: LaTeX output from babel escapes comment delimiter
@ 2012-10-25  0:15 Michael Gauland
  2012-10-25  1:14 ` Thomas S. Dye
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Gauland @ 2012-10-25  0:15 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [new exporter]: LaTeX output from babel escapes comment delimiter
  2012-10-25  0:15 [new exporter]: LaTeX output from babel escapes comment delimiter Michael Gauland
@ 2012-10-25  1:14 ` Thomas S. Dye
  2012-10-25  3:41   ` Nick Dokos
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas S. Dye @ 2012-10-25  1:14 UTC (permalink / raw)
  To: Michael Gauland; +Cc: emacs-orgmode

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 <mikelygee@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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [new exporter]: LaTeX output from babel escapes comment delimiter
  2012-10-25  1:14 ` Thomas S. Dye
@ 2012-10-25  3:41   ` Nick Dokos
  2012-10-25 12:08     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2012-10-25  3:41 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode, Michael Gauland

Thomas S. Dye <tsd@tsdye.com> wrote:

> 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.
> 

I agree with Tom's comments in general, although there might exist
special situations where the output would have to be tweaked and made
less generic.

But even in the original form below, I cannot reproduce Michael's problem: the
% signs are not escaped. I get

--8<---------------cut here---------------start------------->8---
\section{Snippet}
\label{sec-1}
% latex table generated in R 2.12.1 by xtable 1.5-6 package
% Wed Oct 24 23:38:22 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}
% Generated by Org mode 7.9.2 in Emacs 24.2.50.1.
--8<---------------cut here---------------end--------------->8---

Org-mode version 7.9.2 (release_7.9.2-459-g6f7e92 @ /home/nick/elisp/org-mode/lisp/)

Nick

> 
> Michael Gauland <mikelygee@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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [new exporter]: LaTeX output from babel escapes comment delimiter
  2012-10-25  3:41   ` Nick Dokos
@ 2012-10-25 12:08     ` Nicolas Goaziou
  2012-10-25 22:20       ` Michael Gauland
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2012-10-25 12:08 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode, Michael Gauland, Thomas S. Dye

Hello,

Nick Dokos <nicholas.dokos@hp.com> writes:

> But even in the original form below, I cannot reproduce Michael's problem: the
> % signs are not escaped. I get

I cannot reproduce it either.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [new exporter]: LaTeX output from babel escapes comment delimiter
  2012-10-25 12:08     ` Nicolas Goaziou
@ 2012-10-25 22:20       ` Michael Gauland
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Gauland @ 2012-10-25 22:20 UTC (permalink / raw)
  To: emacs-orgmode

Thanks for trying to reproduce this. I tried again from 'emacs -Q', and couldn't
reproduce it either. I'm concluding it's due to some cruft in  my .emacs file,
and not a problem with the exporter.

--Mike

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-25 22:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-25  0:15 [new exporter]: LaTeX output from babel escapes comment delimiter Michael Gauland
2012-10-25  1:14 ` Thomas S. Dye
2012-10-25  3:41   ` Nick Dokos
2012-10-25 12:08     ` Nicolas Goaziou
2012-10-25 22:20       ` Michael Gauland

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).