From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: getting calc-units working in table formulas Date: Tue, 16 Dec 2014 14:06:12 +0100 Message-ID: References: <87oar4ql5t.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0rpO-0007MT-6N for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 08:06:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0rpN-0003b9-1b for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 08:06:14 -0500 Received: from mail-qc0-x231.google.com ([2607:f8b0:400d:c01::231]:47992) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0rpM-0003b3-RW for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 08:06:12 -0500 Received: by mail-qc0-f177.google.com with SMTP id x3so9997449qcv.8 for ; Tue, 16 Dec 2014 05:06:12 -0800 (PST) In-Reply-To: <87oar4ql5t.fsf@ericabrahamsen.net> 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: Eric Abrahamsen Cc: Org Mode Hi Eric This answers only one of your questions: On Tue, Dec 16, 2014 at 5:21 AM, Eric Abrahamsen wrote: > #+BEGIN_SRC emacs-lisp > (defmath uconvert (expr target-units) > (math-convert-units expr target-units)) > #+END_SRC I would prefer #+BEGIN_SRC emacs-lisp (defmath uconv (expr target-units &optional pure) (math-convert-units expr target-units pure)) #+END_SRC > | km | ft | > |-------+---------------------| > | 2.5km | uconvert(2.5 km ft) | > #+TBLFM: $2=uconvert($1 ft) Calc syntax uses comma to separate the function arguments, see examples in e. g. http://orgmode.org/manual/Formula-syntax-for-Calc.html | km | ft | |--------+--------------| | 2.5 km | 8202.0997 ft | #+TBLFM: $2 = uconv($1, ft) Btw, to have the units only in the column header: | km | ft | |-----+-----------| | 2.5 | 8202.0997 | #+TBLFM: $2 = uconv($1 * @<$1, @<$2, t) The same without a user's defmath: | km | ft | |-----+-----------| | 2.5 | 8202.0997 | #+TBLFM: $2 = usimplify($1 * @<$1 / @<$2) Michael