From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Harkins Subject: Using babel to generate org syntax for export Date: Tue, 14 Jan 2014 11:24:22 +0800 Message-ID: <948bc8d8-46f3-4923-9ccb-28f1ed8ad299@dewdrop-world.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2ucN-0006oU-7K for emacs-orgmode@gnu.org; Mon, 13 Jan 2014 22:24:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2ucE-0006Y2-Q8 for emacs-orgmode@gnu.org; Mon, 13 Jan 2014 22:24:43 -0500 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:64650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2ucE-0006Xu-IP for emacs-orgmode@gnu.org; Mon, 13 Jan 2014 22:24:34 -0500 Received: by mail-pa0-f52.google.com with SMTP id kx10so4637287pab.25 for ; Mon, 13 Jan 2014 19:24:33 -0800 (PST) Received: from localhost ([113.103.25.40]) by mx.google.com with ESMTPSA id bz4sm41688595pbb.12.2014.01.13.19.24.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Jan 2014 19:24:32 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: orgmode Hi, Got a question that's not easy to search online. I want to use an org table to define glossary entries for LaTeX. I have my=20= table[1], and I have a src block[2] that reads the table and produces the=20 right syntax[3]. This is already pretty helpful -- I can C-c C-c the source=20= block and manually copy/paste the generated syntax into the org file that I=20= will then export.=20 But... I want babel to do that for me automatically. I'm almost there, but: The resulting string is put into a verbatim environment -- which is not=20 right for this case. I need the string to be inserted as if it were org=20 syntax ("#+LATEX_HEADER" and all) that I typed by hand, and then ox-latex=20 would process it like any other LaTeX header. I've tried both ":results value" and ": results output" but the verbatim=20 environment is always there. A quick glance at ob-core.el seems to indicate that this behavior is=20 hardcoded. That's... frustrating: spend 2-3 hours to get this far and then=20= find that babel says, "No, you can't do that, actually." So, I'm at the end of the energy I have left to test various approaches.=20 What's the best approach? I'm guessing, apply a filter to remove the=20 begin/end verbatim lines. But maybe there's a magic switch in babel? For reference: [1] input file, nearly minimal example [2] actual result of C-c C-e l L (removing preamble) [3] desired result hjh [1] * UGens :noexport: #+name: ugens01 | Type | Term | Description | Arguments | |------+----------+---------------------+-------------| | Osc | SinOsc | Sinewave oscillator | freq, phase | #+name: makegloss #+begin_src emacs-lisp :var tbl=3Dugens01 :exports results :results value (let ((str "")) (pop tbl) (pop tbl) (while tbl (let ((item (car tbl))) (pop item) (setq str (concat str (format=20 "\\newglossaryentry{%s}{type=3Dugen,name=3D{%s},description=3D{%s. Inputs:=20= (%s)}}\n" =09=09 (car item) =09=09 (pop item) =09=09 (pop item) =09=09 (car item)))) (setq tbl (cdr tbl)))) str) #+end_src * Test #+call: makegloss #+results: makegloss [2] \section{Test} \label{sec-1} \begin{verbatim} \newglossaryentry{SinOsc}{type=3Dugen,name=3D{SinOsc},description=3D{Sinewave= =20 oscillator. Inputs: (freq, phase)}} \end{verbatim} [3] \section{Test} \label{sec-1} \newglossaryentry{SinOsc}{type=3Dugen,name=3D{SinOsc},description=3D{Sinewave= =20 oscillator. Inputs: (freq, phase)}}