[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] getting calc-units working in table formulas
From: |
Michael Brand |
Subject: |
Re: [O] getting calc-units working in table formulas |
Date: |
Tue, 16 Dec 2014 14:06:12 +0100 |
Hi Eric
This answers only one of your questions:
On Tue, Dec 16, 2014 at 5:21 AM, Eric Abrahamsen
<address@hidden> 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
- [O] getting calc-units working in table formulas, Eric Abrahamsen, 2014/12/15
- Re: [O] getting calc-units working in table formulas, Eric Abrahamsen, 2014/12/16
- Re: [O] getting calc-units working in table formulas,
Michael Brand <=
- Re: [O] getting calc-units working in table formulas, Eric Abrahamsen, 2014/12/16
- Re: [O] getting calc-units working in table formulas, Michael Brand, 2014/12/17
- Re: [O] getting calc-units working in table formulas, Eric Abrahamsen, 2014/12/17
- Re: [O] [PATCH] getting calc-units working in table formulas, Eric Abrahamsen, 2014/12/18
- Re: [O] [PATCH] getting calc-units working in table formulas, Nicolas Goaziou, 2014/12/20
- Re: [O] [PATCH] getting calc-units working in table formulas, Eric Abrahamsen, 2014/12/20