From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Re: [Babel] Can't export to LaTeX anymore (args-out-of-range 0 0) Date: Tue, 21 Sep 2010 10:19:52 -0600 Message-ID: <87hbhj9ihj.fsf@gmail.com> References: <87tyltj2tq.fsf@mundaneum.com> <87y6b04fyn.fsf@gmail.com> <87wrqkl7pw.fsf@mundaneum.com> <87ocbw48e2.fsf@gmail.com> <87k4mgoykv.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=50974 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oy5Zf-0003rl-6b for emacs-orgmode@gnu.org; Tue, 21 Sep 2010 12:20:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oy5Zd-0002Oc-B8 for emacs-orgmode@gnu.org; Tue, 21 Sep 2010 12:20:07 -0400 Received: from mail-iw0-f169.google.com ([209.85.214.169]:47251) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy5Zd-0002OV-4N for emacs-orgmode@gnu.org; Tue, 21 Sep 2010 12:20:05 -0400 Received: by iwn33 with SMTP id 33so8573534iwn.0 for ; Tue, 21 Sep 2010 09:20:04 -0700 (PDT) In-Reply-To: <87k4mgoykv.fsf@mundaneum.com> (=?utf-8?Q?=22S=C3=A9bastien?= Vauban"'s message of "Tue, 21 Sep 2010 00:10:56 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?S=C3=A9bastien?= Vauban Cc: emacs-orgmode@gnu.org S=C3=A9bastien Vauban writes: > Hi Eric and all the others, > > "Eric Schulte" wrote: >> S=C3=A9bastien Vauban 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 exp= ort >> is not. >> >>> What could be a workaround? >> >> Simply change =3D:results latex=3D to =3D:results org=3D and the code bl= ock body >> will be harmlessly expanded and deposited in the org buffer on export, t= hen >> 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 >> >> <> >> #+end_src > > Question: =3D:results org replace=3D (instead of =3D:results org=3D) is n= ecessary if > we wanna see the results expanded in the Org buffer, on key =3DC-c C-v C-= e=3D. > 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 > > <> > #+end_src > > * Results > > #+LaTeX: \documentclass[11pt]{isodoc} > #+LaTeX: \usepackage[utf8x]{inputenc} > #+LaTeX: \usepackage[T1]{fontenc} > > #+LaTeX: \setupdocument{ > #+LaTeX: to =3D {Eric}, > #+LaTeX: subject =3D {Tough to understand what to do...}, > #+LaTeX: opening =3D {Hi}, > #+LaTeX: closing =3D {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 ex= port > to PDF on =3DC-c C-v C-e=3D. However, when the Org results block =3Dlette= r=3D is > surrounded by LaTeX code, items and tables aren't translated anymore to t= heir > 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 (=3D* Result= s=3D)? > - How to impose my =3Ddocumentclass isodoc=3D instead of =3Darticle=3D? > > 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 =3D {Eric}, > subject =3D {Tough to understand what to do...}, > opening =3D {Hi}, > closing =3D {Best} > } > > \begin{document} > \letter{% > <> > } > \end{document} > #+end_src > > #+results: > #+BEGIN_LaTeX > \documentclass[11pt]{isodoc} > \usepackage[utf8x]{inputenc} > \usepackage[T1]{fontenc} > > \setupdocument{ > to =3D {Eric}, > subject =3D {Tough to understand what to do...}, > opening =3D {Hi}, > closing =3D {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} > first & second \\ > other & last \\ > \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 =3DArgs out of range: 0, 0=3D 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. > > 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=3D30667 > > Questions: > > - Is the above overview right, or am I *still* missing things? > > > - Couldn't =3DC-c C-v C-e=3D tangle to files, when the =3Dtangle=3D param= eter 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 =3DC-c C-v C-e=3D. At my dischar= ge, I > only used tangling once, a couple of months ago, but... > > ... and I think I already had once that request in mind, maybe even ask= ed on > the list. > =3DC-c C-v C-e=3D 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 > > Idealistic goal that I have in mind (so that I share upfront which direct= ions > I would enjoy to be able to follow): > > - be able to produce =3Disodoc=3D letter in PDF just by =3DC-c C-v C-e=3D > by =3DC-c C-v C-e=3D do you mean tangle or execute? > > - 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 = =3DC-c > C-v C-e=3D... > 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 the recipients. Certainly wouldn't be trivial though. Best -- Eric > > Thanks for your help (past, present... and future)! > > Best regards, > Seb