From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyle Andrews Subject: org-spreadsheet: formatting chops off units Date: Wed, 5 Sep 2012 17:46:36 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9NR4-0000sL-Vw for emacs-orgmode@gnu.org; Wed, 05 Sep 2012 17:46:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9NR3-0001Sd-U7 for emacs-orgmode@gnu.org; Wed, 05 Sep 2012 17:46:58 -0400 Received: from mail-iy0-f169.google.com ([209.85.210.169]:40569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9NR3-0001SZ-P4 for emacs-orgmode@gnu.org; Wed, 05 Sep 2012 17:46:57 -0400 Received: by iagk10 with SMTP id k10so1551421iag.0 for ; Wed, 05 Sep 2012 14:46:56 -0700 (PDT) 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 Hello everyone, I want to use an org-spreadsheet to perform unit conversions for me. | Mass (g) | Mass (lb) | |----------+---------------| | 300 g | 0.66138679 lb | | 23 kg | 50.706320 lb | | 50 Mg | 110231.13 lb | #+TBLFM: $2=uconvert($1, lb) I made the table above, but can't figure out how to format the output. I tried using the ;%.2f notation shown in the manual, but it cuts the units off for some reason. Here is what org-table displays with ;%.2f appended onto my table formula: | Mass (g) | Mass (lb) | |----------+---------------| | 300 g | 0.66 | | 23 kg | 50.71 | | 50 Mg | 110231.13 | #+TBLFM: $2=uconvert($1, lb);%.2f Here is what I wish appending ;%.2f would cause org-table to display: | Mass (g) | Mass (lb) | |----------+---------------| | 300 g | 0.66 lb | | 23 kg | 50.71 lb | | 50 Mg | 110231.13 lb | #+TBLFM: $2=uconvert($1, lb);%.2f If you type in '0.66138679 lb into calc directly, and press d f 2, calc displays 0.66 lb as desired. Is there any reason for the %.2f notation chops off the units? Is there some better way to accomplish what I want? Thanks! Note: my spreadsheet uses the wrapper function below to convert units with calc. #+begin_src emacs-lisp (defmath uconvert (expression new-units) (math-convert-units expression new-units))) #+end_src -- Kyle C. Andrews kyle.c.andrews@gmail.com