From mboxrd@z Thu Jan 1 00:00:00 1970 From: "L.C. Karssen" Subject: Trying to use :post header argument to set #+ATTR_LATEX: line Date: Mon, 22 Oct 2018 16:43:45 +0200 Message-ID: <3f496b8f-3ffb-af0d-278a-21669e4e0aca@karssen.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Mzycq6mzwuifXUppjMmRoVDST4toe7vew" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEbR3-000388-7s for emacs-orgmode@gnu.org; Mon, 22 Oct 2018 10:44:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEbQz-00036M-8I for emacs-orgmode@gnu.org; Mon, 22 Oct 2018 10:44:01 -0400 Received: from lb3-smtp-cloud7.xs4all.net ([194.109.24.31]:60190) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gEbQy-00032A-VD for emacs-orgmode@gnu.org; Mon, 22 Oct 2018 10:43:57 -0400 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" To: Org Mode This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Mzycq6mzwuifXUppjMmRoVDST4toe7vew Content-Type: multipart/mixed; boundary="Gupj64KNwIBXs9t3NIWfZmLCFxQZxZ0zL"; protected-headers="v1" From: "L.C. Karssen" To: Org Mode Message-ID: <3f496b8f-3ffb-af0d-278a-21669e4e0aca@karssen.org> Subject: Trying to use :post header argument to set #+ATTR_LATEX: line --Gupj64KNwIBXs9t3NIWfZmLCFxQZxZ0zL Content-Type: multipart/mixed; boundary="------------DBC8F1DC438ECA54DB5166B5" Content-Language: en-GB This is a multi-part message in MIME format. --------------DBC8F1DC438ECA54DB5166B5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Dear list, I'd like to create several tables from R and export those to a LaTeX document. Because only input variable differs for the R code that generates the tables, I thought I could use the :post header argument to add the #+ATTR_LATEX: line I need to each of the outputs of my R source code blocks. I tried to follow the Org manual (section 14.8.2.27), but that doesn't seem to work. My R results blocks all get colons in front of the output and if I set :results drawer, I get the following error: org-babel-R-evaluate-session: Wrong type argument: listp, followed by a double quoted string containing the data, excluding the #+ATTR_LATEX line. I have attached an example Org file that illustrates what I am trying to achieve and where it goes wrong. I tested this using Emacs 26.1 of 2018-05-29 and Org 9.1.13 from elpa (2018-06-25). In short, I'm trying the following: #+name: attr_wrap #+begin_src R :var data=3D"" :results output cat("#+ATTR_LATEX: :environment tabularx :width \\textwidth :align Xrrr", "\n") data #+end_src #+name: create_table2 #+begin_src R :rownames yes :colnames yes :var brand=3D"Mazda" :post attr_wrap(data=3D*this*) mtcars[grepl(brand, rownames(mtcars)), c("mpg", "cyl", "disp")] #+end_src And call it: #+call: create_table2(brand=3D"Toyota") #+RESULTS: : #+ATTR_LATEX: :environment tabularx :width \textwidth :align Xrrr : X mpg cyl disp : 1 Toyota Corolla 33.9 4 71.1 : 2 Toyota Corona 21.5 4 120.1 Note that the whole results block is preceded by a colon, instead of the table being formatted by Org. Thanks for any help! Best regards, Lennart. --=20 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* L.C. Karssen 's-Hertogenbosch The Netherlands lennart@karssen.org http://blog.karssen.org GPG key ID: A88F554A -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- --------------DBC8F1DC438ECA54DB5166B5 Content-Type: text/plain; charset=UTF-8; name="org-source-block-post.org" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="org-source-block-post.org" IytUSVRMRTogVGVzdGluZyB0aGUgOnBvc3QgaGVhZGVyIGFyZwoKIyBTZXQgc29tZSBPc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uZCwgcm93bmFtZXMobXRjYXJzKSksIGMoIm1wZyIs ICJjeWwiLCAiZGlzcCIpXQogICMrZW5kX3NyYwoKICBBbmQgY2FsbCBpdDoKICAjK2NhbGw6 IGNyZWF0ZV90YWJsZTMoYnJhbmQ9IlRveW90YSIpCgogICMrUkVTVUxUUzoKICA6ICMrQVRU Ul9MQVRFWDogOmVudmlyb25tZW50IHRhYnVsYXJ4IDp3aWR0aCBcdGV4dHdpZHRoIDphbGln biBYcnJyCiAgOiBUb3lvdGEgQ29yb2xsYQkzMy45CTQJNzEuMQogIDogVG95b3RhIENvcm9u YQkyMS41CTQJMTIwLjEKCiAgT2JzZXJ2ZSB0aGF0IG5vdyB0aGUgY29sdW1uIG5hbWVzIGhh dmUgY29tcGxldGVseSBkaXNhcHBlYXJlZC4K --------------DBC8F1DC438ECA54DB5166B5-- --Gupj64KNwIBXs9t3NIWfZmLCFxQZxZ0zL-- --Mzycq6mzwuifXUppjMmRoVDST4toe7vew Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEAREIAB0WIQQyBENSov4Y8H9uObIgAxQL2pzVCQUCW83iJwAKCRAgAxQL2pzV CSgAAP4tzGICR63ioxNQ2ZaSYqsVjHKL8BZlRtqI41/SYnkFPgD+PwYdFa4SbTyu VbqDNHHs9/AVjENZ6PTosPn+ArrGJjY= =jHsi -----END PGP SIGNATURE----- --Mzycq6mzwuifXUppjMmRoVDST4toe7vew--