[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] getting calc-units working in table formulas
From: |
Eric Abrahamsen |
Subject: |
Re: [O] getting calc-units working in table formulas |
Date: |
Tue, 16 Dec 2014 14:33:44 +0800 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) |
Eric Abrahamsen <address@hidden> writes:
> I've been playing with calc-units, and it's pretty amazing. See all the
> units with `calc-view-units-table'.
>
> Some calc-units stuff works out the box (maybe have to require
> calc-units?), I think this should be mentioned in the manual:
>
> | distance | time | speed |
> |----------+--------+-------------|
> | 3 km | 2.5 hr | 1.2 km / hr |
>
> #+TBLFM: @2$3=$1/$2
>
> Who knew it could do that?! Probably everyone but me... It doesn't need
> the constants.el package, and looks nicer in the input, to boot.
>
> calc-units makes a few of its functions available via defmath:
>
> | speed | simplified speed |
> |--------------+------------------|
> | 40km / 2.5hr | 16. km / hr |
> | | |
>
> #+TBLFM: @2$2=usimplify($1)
>
> But it's got a lot more tricks. I think unit conversion would be very
> handy to have, but there's something I'm not getting about using
> defmath. For instance, this works:
>
> | km | ft |
> |-------+---------|
> | 2.5km | 8202.10 |
>
> #+TBLFM: $2='(calc-eval (math-convert-units (calc-eval $1 'raw) (calc-eval
> "ft" 'raw))); %.2f
I wonder if the problem is the 'raw in here. To the best of my
knowledge, calc-eval needs that 'raw flag to work properly with this.
But it doesn't look like `org-table-eval-formula' will ever send that
flag. I hope someone who knows this code better than me can comment...
- [O] getting calc-units working in table formulas, Eric Abrahamsen, 2014/12/15
- Re: [O] getting calc-units working in table formulas,
Eric Abrahamsen <=
- Re: [O] getting calc-units working in table formulas, Michael Brand, 2014/12/16
- 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