From mboxrd@z Thu Jan 1 00:00:00 1970 From: Austin Frank Subject: Re: [babel] apply #+TABLEFM lines during export? Date: Mon, 12 Jul 2010 22:59:42 -0500 Message-ID: References: <87hbk5mh9j.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0899756324==" Return-path: Received: from [140.186.70.92] (port=48244 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYWfA-0002Hn-LX for emacs-orgmode@gnu.org; Tue, 13 Jul 2010 00:00:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYWf9-0007tC-43 for emacs-orgmode@gnu.org; Tue, 13 Jul 2010 00:00:08 -0400 Received: from lo.gmane.org ([80.91.229.12]:43078) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYWf8-0007st-Kv for emacs-orgmode@gnu.org; Tue, 13 Jul 2010 00:00:07 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OYWf3-0001gK-Jj for emacs-orgmode@gnu.org; Tue, 13 Jul 2010 06:00:01 +0200 Received: from adsl-209-30-144-201.dsl.stlsmo.swbell.net ([209.30.144.201]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 Jul 2010 06:00:01 +0200 Received: from austin.frank by adsl-209-30-144-201.dsl.stlsmo.swbell.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 Jul 2010 06:00:01 +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: emacs-orgmode@gnu.org --===============0899756324== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --=-=-= Content-Transfer-Encoding: quoted-printable On Sun, Jul 11 2010, Eric Schulte wrote: > Under the current setup, I don't know of a way to ensure that the > formula will be re-run. This may be a good place for future > (post-feature-freeze) functionality. There has also been discussion > of adding a header argument for "post-processing" code blocks which > could accept the output of the evaluated code block as input -- this > might be related. Yes, eager to see where this goes. > As a work-around, I would suggest the following emacs-lisp code block. > Export of this code block will trigger the evaluation of the R code > block, and it will then trim the output of said block resulting in the > desired table precision. > > #+begin_src emacs-lisp :var tab=3Danova-example :colnames yes :cache yes > (mapcar > (lambda (row) > (mapcar > (lambda (cell) (if (numberp cell) (format "%.4f" cell) cell)) > row)) > tab) > #+end_src I tried to customize your approach to apply to the whole buffer. This code seems to do a nice job of changing the appearance of the tables within the buffer, but the extra precision is still maintained on export. =2D-8<---------------cut here---------------start------------->8--- #+source: format-table-floats #+BEGIN_SRC emacs-lisp :results silent :exports none (add-hook 'org-export-preprocess-final-hook (lambda () (while (re-search-forward "|?[ ]+\\(-?[0-9]+\\.[0-9]+\\)\\(e-\\)?[ ]+|" nil t) (progn (replace-match (concat (format "%.4f" (string-to-number (match-string 1))) " |")) (org-table-align))))) #+END_SRC =2D-8<---------------cut here---------------end--------------->8--- Can anyone suggest another approach that would change the precision of floats in all tables in the buffer before export? Perhaps there's a different hook I should be using for LaTeX export? Thanks! /au =2D-=20 Austin Frank http://aufrank.net GPG Public Key (D7398C2F): http://aufrank.net/personal.asc --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iEYEARECAAYFAkw75K4ACgkQlHMl2/XbR4E4jACfQJwtp75OhoKNYedNmnxDSNKP FUMAniUcx4fmJMYsp3c4DOwsmvKfMWK+ =sjp3 -----END PGP SIGNATURE----- --=-=-=-- --===============0899756324== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0899756324==--