Re: [Orgmode] Re: [Babel] Can't export to LaTeX anymore (args-out-of-range 0 0)

2010-09-21 Thread Eric Schulte
Sébastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hi Eric and all the others,

 Eric Schulte wrote:
 Sébastien Vauban wxhgmqzgw...@spammotel.com writes:
 Eric Schulte wrote:
 The error occurs with such a simple document:

 #+TITLE: Org-isodoc
 #+LANGUAGE:  en_US

 * Context

 This is a letter sample.

 * Subject
 #+srcname: subject
 #+begin_src org :results latex
 Composing letters using Org mode and the LaTeX isodoc class
 #+end_src

 This is a tricky problem indeed. [...] This fix will probably take some
 time to implement, and until then I don't think it will be possible to
 evaluate org-mode blocks during export.

 Noweb expansion is still possible, however explicitly performing the export
 is not.

 What could be a workaround?

 Simply change =:results latex= to =:results org= and the code block body
 will be harmlessly expanded and deposited in the org buffer on export, then
 carried along with the rest of the file for export.

 * Subject
 #+source: me
 #+begin_src org
   I am *eric*.
 #+end_src

 #+srcname: subject
 #+begin_src org :results org replace :noweb yes
 Composing letters using *Org mode* and the LaTeX isodoc class

 me
 #+end_src

 Question: =:results org replace= (instead of =:results org=) is necessary if
 we wanna see the results expanded in the Org buffer, on key =C-c C-v C-e=.
 Why?


by default org mode blocks do not insert their results, this was due to
their initial use to wrap results of code blocks.  This can be changed
in your personal configuration by customizing the value of the
`org-babel-default-header-args:org' variable.


 Trying to build on the route you mention, I come up with different
 solutions, such as:

 #+TITLE: Org-isodoc
 #+AUTHOR:Seb Vauban
 #+DATE:  2010-09-20

 * COMMENT Parameters

 #+source: contents
 #+begin_src org
 My body includes a list:

 - one
 - two

 and a small table:

 | first | second |
 | other | last   |

 Not more.
 #+end_src

 #+srcname: letter
 #+begin_src org :results org replace :noweb yes
 Composing letters using *Org mode* and the LaTeX isodoc class

 contents
 #+end_src

 * Results

 #+LaTeX: \documentclass[11pt]{isodoc}
 #+LaTeX: \usepackage[utf8x]{inputenc}
 #+LaTeX: \usepackage[T1]{fontenc}

 #+LaTeX: \setupdocument{
 #+LaTeX: to = {Eric},
 #+LaTeX: subject = {Tough to understand what to do...},
 #+LaTeX: opening = {Hi},
 #+LaTeX: closing = {Best}
 #+LaTeX: }

 #+LaTeX: \begin{document}
 #+LaTeX: {}\letter{%

 #+results: letter
 #+BEGIN_SRC org
 Composing letters using *Org mode* and the LaTeX isodoc class

 My body includes a list:

 - one
 - two

 and a small table:

 | first | second |
 | other | last   |

 Not more.
 #+END_SRC

 #+LaTeX: }
 #+LaTeX: \end{document}

 Asking for Org results, as you mentioned, made me dream about a direct export
 to PDF on =C-c C-v C-e=. However, when the Org results block =letter= is
 surrounded by LaTeX code, items and tables aren't translated anymore to their
 LaTeX counterparts.


true, your outer-most block would have to be an org-mode block, which
could include LaTeX sections if they were already surrounded in
begin/end_latex blocks.


 OK, even if it doe, I still have a couple of problems to resolve:

 - How to avoid generating the title of the exported headline (=* Results=)?
 - How to impose my =documentclass isodoc= instead of =article=?

 and maybe more.


Yes, it may not be possible to export directly to a latex letter using
Org-mode's build latex exporter.  I think the tangling solution you
mention below may be preferable.


 Then, if I understand correctly, the only fallback is the tangling
 solution:


agreed.


 * Letter
   :PROPERTIES:
   :ID:   02360e5c-8f76-4e6d-a98f-b8c5fa2a3da4
   :END:

 #+source: body
 #+begin_src org :results latex
 My body includes a list:

 - one
 - two

 and a small table:

 | first | second |
 | other | last   |

 Not more.
 #+end_src

 #+begin_src latex :noweb yes :tangle yes
 \documentclass[11pt]{isodoc}
 \usepackage[utf8x]{inputenc}
 \usepackage[T1]{fontenc}

 \setupdocument{
 to = {Eric},
 subject = {Tough to understand what to do...},
 opening = {Hi},
 closing = {Best}
 }

 \begin{document}
 \letter{%
 body()
 }
 \end{document}
 #+end_src

 #+results:
 #+BEGIN_LaTeX
 \documentclass[11pt]{isodoc}
 \usepackage[utf8x]{inputenc}
 \usepackage[T1]{fontenc}

 \setupdocument{
 to = {Eric},
 subject = {Tough to understand what to do...},
 opening = {Hi},
 closing = {Best}
 }

 \begin{document}
 \letter{%
 My body includes a list:

 \begin{itemize}
 \item one
 \item two
 \end{itemize}

 and a small table:


 \begin{center}
 \begin{tabular}{ll}
  firstsecond  \\
  otherlast\\
 \end{tabular}
 \end{center}



 Not more.

 }
 \end{document}
 #+END_LaTeX

 Here, the above results is perfectly translated into LaTeX. But trying to
 export this buffer raises the =Args out of range: 0, 0= error.


This is the same error we discovered earlier, namely trying to export
the body of an 

[Orgmode] Re: [Babel] Can't export to LaTeX anymore (args-out-of-range 0 0)

2010-09-21 Thread Sébastien Vauban
Hi Eric,

Eric Schulte wrote:
 Sébastien Vauban wxhgmqzgw...@spammotel.com writes:
 Eric Schulte wrote:
 [...]
 #+srcname: subject
 #+begin_src org :results org replace :noweb yes
 Composing letters using *Org mode* and the LaTeX isodoc class

 me
 #+end_src

 Question: =:results org replace= (instead of =:results org=) is necessary
 if we wanna see the results expanded in the Org buffer, on key =C-c C-v
 C-e=. Why?

 by default org mode blocks do not insert their results, this was due to
 their initial use to wrap results of code blocks. This can be changed in
 your personal configuration by customizing the value of the
 `org-babel-default-header-args:org' variable.

OK. Clear.


 Asking for Org results, as you mentioned, made me dream about a direct
 export to PDF on =C-c C-v C-e=. However, when the Org results block
 =letter= is surrounded by LaTeX code, items and tables aren't translated
 anymore to their LaTeX counterparts.

 true, your outer-most block would have to be an org-mode block, which could
 include LaTeX sections if they were already surrounded in begin/end_latex
 blocks.

Never thought about having blocks *inside* blocks...

Tried things such as the following:

--8---cut here---start-8---
#+OPTIONS:   H:3 num:nil toc:nil
#+LaTeX_CLASS: isodoc

#+LaTeX_HEADER: \setupdocument{
#+LaTeX_HEADER: to = {%
#+LaTeX_HEADER:   Org mode user group \\
#+LaTeX_HEADER:   World Wide Web
#+LaTeX_HEADER:   },
#+LaTeX_HEADER: subject = {Composing letters using Org mode and the 
\LaTeX{} isodoc class},
#+LaTeX_HEADER: opening = {Dear Org mode users},
#+LaTeX_HEADER: closing = {Yours Truly}
#+LaTeX_HEADER: }

#+source: contents
#+begin_src org :results silent :exports none
My body includes a list:

- one
- two

and a small table:

| here  | second |
| other | last   |

Not more.
#+end_src

#+BEGIN_SRC org

#+BEGIN_LaTeX
\letter{%
#+END_LaTeX

#+srcname: letter
#+begin_src org :results raw :noweb yes
Composing letters using *Org mode* and the LaTeX isodoc class

contents
#+end_src

#+BEGIN_LaTeX
}
#+END_LaTeX

#+END_SRC
--8---cut here---end---8---

 It may not be possible to export directly to a latex letter using Org-mode's
 build latex exporter. I think the tangling solution you mention below may be
 preferable.

I'm approaching, but am not still where I need to be: the =#+END_SRC= does not
seem to be correctly nested... The inner one gets related to the outer
=#+BEGIN_SRC=.


 Then, if I understand correctly, the only fallback is the tangling
 solution:

 agreed.

 Here, the above results is perfectly translated into LaTeX. But trying to
 export this buffer raises the =Args out of range: 0, 0= error.

 This is the same error we discovered earlier, namely trying to export the
 body of an Org-mode block to latex in the middle of a latex export. I've
 pushed up a more useful error message.

Yes. I was re-injecting previous results, to make the overview complete.


 The solution is to tangle it, and launch pdflatex on the tangled file.

 agreed. BTW: I've just pushed up a code block to the library of babel which
 makes it possible to include headlines into noweb exports. I imagine this
 would be very useful when composing letters in this manner. See the email
 where I initially mention this
 http://thread.gmane.org/gmane.emacs.orgmode/29926/focus=30667

Thanks.


 - Couldn't =C-c C-v C-e= tangle to files, when the =tangle= parameter is
   present?  FYI, I've lost some amount of time (won't tell you how much, I'm
   ashamed) thinking that the tangling process did not work anymore on my
   machine, because I was expecting it on =C-c C-v C-e=. At my discharge, I
   only used tangling once, a couple of months ago, but...

   ... and I think I already had once that request in mind, maybe even asked
   on the list.

 =C-c C-v C-e= is already used for executing code blocks, unfortunately
 key-bindings are at a premium, so I don't think it is worth re-binding this
 -- although I do see how you could be confused

I meant: for me, when there is a tangle directive, executing the code block
*is* tangling. Or, at least, tangling should be done at the same time as the
execution.

Maybe, you want to explicitly separate both functions, though.


 Idealistic goal that I have in mind (so that I share upfront which
 directions I would enjoy to be able to follow):

 - be able to produce =isodoc= letter in PDF just by =C-c C-v C-e=

 by =C-c C-v C-e= do you mean tangle or execute?

I meant, thus, when executing (here, producing the letter).


 - next step: be able to produce /mail merge/ (publiposting), having in
   Org the list of recipients and the letter's contents -- both in one
   unique Org file --, and producing all the letters at once (in one PDF),
   just by =C-c C-v C-e=...

 this shouldn't be impossible with the current setup, maybe use sbe to call a
 code block on every row of a table with the table holding 

[Orgmode] Re: [Babel] Can't export to LaTeX anymore (args-out-of-range 0 0)

2010-09-20 Thread Sébastien Vauban
Hi Eric and all the others,

Eric Schulte wrote:
 Sébastien Vauban wxhgmqzgw...@spammotel.com writes:
 Eric Schulte wrote:
 The error occurs with such a simple document:

 #+TITLE: Org-isodoc
 #+LANGUAGE:  en_US

 * Context

 This is a letter sample.

 * Subject
 #+srcname: subject
 #+begin_src org :results latex
 Composing letters using Org mode and the LaTeX isodoc class
 #+end_src

 This is a tricky problem indeed. [...] This fix will probably take some
 time to implement, and until then I don't think it will be possible to
 evaluate org-mode blocks during export.

 Noweb expansion is still possible, however explicitly performing the export
 is not.

 What could be a workaround?

 Simply change =:results latex= to =:results org= and the code block body
 will be harmlessly expanded and deposited in the org buffer on export, then
 carried along with the rest of the file for export.

 * Subject
 #+source: me
 #+begin_src org
   I am *eric*.
 #+end_src

 #+srcname: subject
 #+begin_src org :results org replace :noweb yes
 Composing letters using *Org mode* and the LaTeX isodoc class

 me
 #+end_src

Question: =:results org replace= (instead of =:results org=) is necessary if
we wanna see the results expanded in the Org buffer, on key =C-c C-v C-e=.
Why?

Trying to build on the route you mention, I come up with different solutions,
such as:

--8---cut here---start-8---
#+TITLE: Org-isodoc
#+AUTHOR:Seb Vauban
#+DATE:  2010-09-20

* COMMENT Parameters

#+source: contents
#+begin_src org
My body includes a list:

- one
- two

and a small table:

| first | second |
| other | last   |

Not more.
#+end_src

#+srcname: letter
#+begin_src org :results org replace :noweb yes
Composing letters using *Org mode* and the LaTeX isodoc class

contents
#+end_src

* Results

#+LaTeX: \documentclass[11pt]{isodoc}
#+LaTeX: \usepackage[utf8x]{inputenc}
#+LaTeX: \usepackage[T1]{fontenc}

#+LaTeX: \setupdocument{
#+LaTeX: to = {Eric},
#+LaTeX: subject = {Tough to understand what to do...},
#+LaTeX: opening = {Hi},
#+LaTeX: closing = {Best}
#+LaTeX: }

#+LaTeX: \begin{document}
#+LaTeX: {}\letter{%

#+results: letter
#+BEGIN_SRC org
Composing letters using *Org mode* and the LaTeX isodoc class

My body includes a list:

- one
- two

and a small table:

| first | second |
| other | last   |

Not more.
#+END_SRC

#+LaTeX: }
#+LaTeX: \end{document}
--8---cut here---end---8---

Asking for Org results, as you mentioned, made me dream about a direct export
to PDF on =C-c C-v C-e=. However, when the Org results block =letter= is
surrounded by LaTeX code, items and tables aren't translated anymore to their
LaTeX counterparts.

OK, even if it doe, I still have a couple of problems to resolve:

- How to avoid generating the title of the exported headline (=* Results=)?
- How to impose my =documentclass isodoc= instead of =article=?

and maybe more.

Then, if I understand correctly, the only fallback is the tangling solution:

--8---cut here---start-8---
* Letter
  :PROPERTIES:
  :ID:   02360e5c-8f76-4e6d-a98f-b8c5fa2a3da4
  :END:

#+source: body
#+begin_src org :results latex
My body includes a list:

- one
- two

and a small table:

| first | second |
| other | last   |

Not more.
#+end_src

#+begin_src latex :noweb yes :tangle yes
\documentclass[11pt]{isodoc}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

\setupdocument{
to = {Eric},
subject = {Tough to understand what to do...},
opening = {Hi},
closing = {Best}
}

\begin{document}
\letter{%
body()
}
\end{document}
#+end_src

#+results:
#+BEGIN_LaTeX
\documentclass[11pt]{isodoc}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

\setupdocument{
to = {Eric},
subject = {Tough to understand what to do...},
opening = {Hi},
closing = {Best}
}

\begin{document}
\letter{%
My body includes a list:

\begin{itemize}
\item one
\item two
\end{itemize}

and a small table:


\begin{center}
\begin{tabular}{ll}
 firstsecond  \\
 otherlast\\
\end{tabular}
\end{center}



Not more.

}
\end{document}
#+END_LaTeX
--8---cut here---end---8---

Here, the above results is perfectly translated into LaTeX. But trying to
export this buffer raises the =Args out of range: 0, 0= error.

The solution is to tangle it, and launch pdflatex on the tangled file.

Questions:

- Is the above overview right, or am I *still* missing things?

- Couldn't =C-c C-v C-e= tangle to files, when the =tangle= parameter is
  present?  FYI, I've lost some amount of time (won't tell you how much, I'm
  ashamed) thinking that the tangling process did not work anymore on my
  machine, because I was expecting it on =C-c C-v C-e=. At my discharge, I
  only used tangling once, a couple of months ago, but...

  ... and I think I already had once that request in mind, maybe even asked on
  the list.

Idealistic 

[Orgmode] Re: [Babel] Can't export to LaTeX anymore (args-out-of-range 0 0)

2010-09-17 Thread Sébastien Vauban
Hi Eric,

Eric Schulte wrote:
 The error occurs with such a simple document:

 #+TITLE: Org-isodoc
 #+LANGUAGE:  en_US

 * Context

 This is a letter sample.

 * Subject
 #+srcname: subject
 #+begin_src org :results latex
 Composing letters using Org mode and the LaTeX isodoc class
 #+end_src

 This is a tricky problem indeed. After some debugging, it appears that the
 problem is the result of the org code block calling `org-export-as-latex'
 on its body, while `org-export-as-latex' is already called on the entire
 org-mode file. Apparently the Org-mode exporter is not currently able to
 handle nested export calls, because the name of the temporary export buffer
 is hard coded into `org-export-preprocess-string', meaning that the buffer
 is re-used and deleted by the nested export call.

 This fix will probably take some time to implement, and until then I don't
 think it will be possible to evaluate org-mode blocks during export.

OK. Am I right, then, to conclude that the discussed Noweb route must be
abandoned (at least, temporarily) for writing isodoc letters?

What could be a workaround?

Thanks a lot...

Best regards,
  Seb

-- 
Sébastien Vauban


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: [Babel] Can't export to LaTeX anymore (args-out-of-range 0 0)

2010-09-17 Thread Eric Schulte
Hi Seb,

Sébastien Vauban wxhgmqzgw...@spammotel.com writes:

 Hi Eric,

 Eric Schulte wrote:
 The error occurs with such a simple document:

 #+TITLE: Org-isodoc
 #+LANGUAGE:  en_US

 * Context

 This is a letter sample.

 * Subject
 #+srcname: subject
 #+begin_src org :results latex
 Composing letters using Org mode and the LaTeX isodoc class
 #+end_src

 This is a tricky problem indeed. After some debugging, it appears that the
 problem is the result of the org code block calling `org-export-as-latex'
 on its body, while `org-export-as-latex' is already called on the entire
 org-mode file. Apparently the Org-mode exporter is not currently able to
 handle nested export calls, because the name of the temporary export buffer
 is hard coded into `org-export-preprocess-string', meaning that the buffer
 is re-used and deleted by the nested export call.

 This fix will probably take some time to implement, and until then I don't
 think it will be possible to evaluate org-mode blocks during export.

 OK. Am I right, then, to conclude that the discussed Noweb route must be
 abandoned (at least, temporarily) for writing isodoc letters?


Noweb expansion is still possible, however explicitly performing the
export is not.


 What could be a workaround?


Simply change =:results latex= to =:results org= and the code block body
will be harmlessly expanded and deposited in the org buffer on export,
then carried along with the rest of the file for export.

--8---cut here---start-8---
#+TITLE: Org-isodoc
#+AUTHOR:Seb Vauban
#+DATE:  2010-09-13
#+LANGUAGE:  en_US

* Context

This is a letter sample.

* Subject
#+source: me
#+begin_src org
  I am *eric*.
#+end_src

#+srcname: subject
#+begin_src org :results org replace :noweb yes
Composing letters using *Org mode* and the LaTeX isodoc class

me
#+end_src
--8---cut here---end---8---

I should have mentioned this in my earlier email.


 Thanks a lot...


My pleasure.

Best -- Eric


 Best regards,
   Seb

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode