From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Halder Subject: Re: table as parameter for latex block Date: Sun, 18 Mar 2012 20:55:44 +0100 Message-ID: <3EF97662-6C13-4043-B9FC-6D826DBD7F4D@gmail.com> References: <3F1A1157-9068-4F41-AD35-A6D926DF69F5@gmail.com> Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:60989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9MCq-0007xf-1p for emacs-orgmode@gnu.org; Sun, 18 Mar 2012 15:56:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9MCm-0001pU-66 for emacs-orgmode@gnu.org; Sun, 18 Mar 2012 15:55:55 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:63587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9MCl-0001lz-U8 for emacs-orgmode@gnu.org; Sun, 18 Mar 2012 15:55:52 -0400 Received: by wibhj13 with SMTP id hj13so2246498wib.12 for ; Sun, 18 Mar 2012 12:55:49 -0700 (PDT) In-Reply-To: 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: "Thomas S. Dye" Cc: emacs-orgmode@gnu.org > Martin Halder writes: >=20 >>> Martin Halder writes: >>>=20 >>>> Hi all, >>>>=20 >>>> was trying to use a table as input for a latex block. Is there a = way to directly reference parts of the table inside the block or do I = have to specify each parameter as separate parameter ? >>>>=20 >>>> Thanks for help, >>>> Martin >>> Aloha Martin, >>>=20 >>> Can I ask why you want to use a table as input for a latex block? = An >>> alternative is to send the table to a source block in some other >>> language and then evaluate with :results latex. The advantage is = that >>> the other language can have loops and complex data types that make = it >>> relatively easy to deal with tables. It might be possible to do = these >>> kinds of things with TeX, but it is likely to be difficult. >>>=20 >>> hth, >>> Tom >>=20 >> Aloha Tom, >>=20 >> the reason was that I have a quite complex latex file in a src latex = block (which I tangle) >> and just wanted to replace some variables from a table. >>=20 >> But :results latex looks very interesting, will have a look if I can = solve it with that one, >> many thanks for the hint. >>=20 >> This is my use case, the example below was maybe too much simplified: >>=20 >> #begin_src latex >> ... weird latex code >> \put(-2,-50){ >> \parbox{8cm}{ >> \tiny{mycompany - mystree - mycountry}\\ \\ >> \normalsize >> \textbf{company}\\ >> street\\ >> \textbf{country} >> \vspace{2mm}\\ >> } >> } >> ... weird latex code >> #end_src latex >=20 > Aloha Martin, >=20 > Here is the basic idea in pseudo python. =20 >=20 > #begin_src python :results output latex > ... weird latex code > s =3D ''' \\put(-2,-50){ > \\parbox{8cm}{ > \\tiny{%s - %s - %s}\\\\ \\\\ > \\normalsize > \\textbf{%s}\\\\ > street\\\\ > \\textbf{%s} > \\vspace{2mm}\\\\ > } > }''' % (mycompany, mystree, mycountry, company, country) > print s > ... weird latex code > #end_src python >=20 > hth, > Tom Aloha Tom, great, thanks. This one is working. Did not think about sending the = whole file through python. Cheers, Martin >>=20 >> Cheers, >> Martin >>=20 >>>=20 >>>>=20 >>>> This is working: >>>>=20 >>>> #+tblname: data >>>> | Name | John Doe | >>>> | Address | Doestreet 42 | >>>> | Country | Doecountry | >>>>=20 >>>> #+name: invoice(name=3Ddata[0,1], address=3Ddata[1,1], = country=3Ddata[2,1]) >>>> #+begin_src latex >>>> name >>>> address >>>> country >>>> #+end_src >>>>=20 >>>> #+RESULTS: invoice >>>> #+BEGIN_LaTeX >>>> John Doe >>>> Doestreet 42 >>>> Doecountry >>>> #+END_LaTeX >>>>=20 >>>> what I would like to do: >>>>=20 >>>> #+name: invoice(data=3Ddata) >>>> #+begin_src latex >>>> data[0,1] >>>> data[1,1] >>>> data[2,1] >>>> #+end_src >>>>=20 >>>> or even better: >>>>=20 >>>> #+name: invoice(data=3Ddata) >>>> #+begin_src latex >>>> data['Name'] >>>> data['Adress'] >>>> data['Country'] >>>> #+end_src >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>=20 >>> --=20 >>> Thomas S. Dye >>> http://www.tsdye.com >>=20 >=20 > --=20 > T.S. Dye & Colleagues, Archaeologists > 735 Bishop St, Suite 315, Honolulu, HI 96813 > Tel: 808-529-0866, Fax: 808-529-0884 > http://www.tsdye.com