From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: babel output as LaTeX code: help please! Date: Tue, 10 Mar 2015 08:42:15 -1000 Message-ID: References: <871tkwn4sm.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVP74-0003Jc-9m for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 14:42:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVP70-0002HQ-Dd for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 14:42:42 -0400 Received: from gproxy2-pub.mail.unifiedlayer.com ([69.89.18.3]:52853) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1YVP70-0002G5-6T for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 14:42:38 -0400 Received: from [72.253.144.27] (port=55001 helo=manifi) by box472.bluehost.com with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.82) (envelope-from ) id 1YVP6g-0004E9-Ru for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 12:42:19 -0600 In-Reply-To: <871tkwn4sm.fsf@ucl.ac.uk> (Eric S. Fraga's message of "Tue, 10 Mar 2015 17:25:13 +0000") 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: emacs-orgmode@gnu.org Hi Eric, Eric S Fraga writes: > Hi, > > I am using babel with awk to generate some LaTeX code that I would like > exported and interpreted as LaTeX. I have the following which works if > I were to use the src block directly but I wish to /call/ the src block > with different tables: > > #+begin_src org > ,* layout > ,#+caption: Position of each circle > ,#+tblname: solution > | | \(R_i\) | \(r_i\) | \(\theta_i\) | \(x\) | \(y\) | > |---+---------+-----------+--------------+--------+--------| > | 1 | 6 | 19.834868 | 5.358859 | 11.95 | -15.83 | > | 2 | 7 | 21.443075 | 0.101102 | 21.33 | 2.16 | > | 3 | 8 | 19.005610 | 1.547045 | 0.45 | 19.00 | > | 4 | 9 | 20.688749 | 3.604317 | -18.51 | -9.24 | > | 5 | 11 | 0.046762 | 3.863237 | -0.04 | -0.03 | > ,#+TBLFM: $5=$3*cos($4);R%.2f::$6=$3*sin($4);R%.2f > > ,#+call: drawlayout[:stdin solution]() > > ,#+name: drawlayout > ,#+header: :results raw > ,#+begin_src awk > BEGIN { > print "#+begin_latex" > print "\\begin{tikzpicture}[scale=0.1]" > print "\\draw" > } > /^[0-9]/ { > printf("(%f,%f) circle (%f) node {%d}\n", $5, $6, $2, $1); > } > END { > print ";" > print "\\end{tikzpicture}" > print "#+end_latex" > } > ,#+end_src > #+end_src > > I cannot figure out the magic incantation of [inside header arguments] > and [end header arguments] that will export the output of the awk block > when called as raw LaTeX code. > > If I put ":results raw" and ":exports results" on the src block, > exporting that block works just fine. The call however is wrapped in an > EXAMPLE block which does me no good! > > Any suggestions welcome! Have you tried #+call: drawlayout[:stdin solution]() :results raw or, #+call: drawlayout[:stdin solution]() :results latex which should make the print "#+begin_latex" etc. lines of drawlayout redundant? All the best, Tom -- Thomas S. Dye http://www.tsdye.com