org-mode-ox-odt icon indicating copy to clipboard operation
org-mode-ox-odt copied to clipboard

Add support for vmax, vmin etc

Open ouboub opened this issue 1 year ago • 3 comments

Hi

the following two tables work perfectly in org mode (their goal is to provide a second column that is a rescaled version of the first column

#+Name: rescaling1
| Numbers | rescaled |
|---------+----------|
|       5 |    0.625 |
|       6 |     0.75 |
|       7 |    0.875 |
|       8 |        1 |
|       1 |    0.125 |
|       1 |    0.125 |
#+TBLFM: $2=$1/vmax(@2$1..@5$1)::

and

#+Name: rescaling2
| Numbers | rescaled |
|---------+----------|
|       5 |    0.625 |
|       6 |     0.75 |
|       7 |    0.875 |
|       8 |        1 |
|       1 |    0.125 |
|       1 |    0.125 |
|---------+----------|
#+TBLFM: $2=$1/vmax(@I$1..@II$1)::

none of them can be exported to ods because the function vmax is not known to ods. Now I can make a smale change to the first table, that it gets correctly exported by just replacing vmax by max (in this case it does not work any more as a org table using calc)

#+Name: rescaling1
| Numbers | rescaled |
|---------+----------|
|       5 |    0.625 |
|       6 |     0.75 |
|       7 |    0.875 |
|       8 |        1 |
|       1 |    0.125 |
|       1 |    0.125 |
#+TBLFM: $2=$1/max(@2$1..@5$1)::

that trick does not work for the second table, because it seems that neigher the exporter nor ods understand @I (that is not so important @I is convinient, but not essential) attached you find the ods file using max and not vmax of the first example

so the simple question is: how to define an alias max, which does the same as vmax (and will no interfere with the native max command in org) regards

bugmax#rescaling1.ods

ouboub avatar Oct 03 '23 06:10 ouboub

how to define an alias max, which does the same as vmax

The mapping is done via variable org-ods-calc-f->ods-f-alist ... See commit https://github.com/kjambunathan/org-mode-ox-odt/commit/e3ca7833b5b95c2318510b00bc005c9b3f6ac72d

kjambunathan avatar Oct 03 '23 08:10 kjambunathan

rescaling1 should work now.


With regard to rescaling2 ... it works but with a caveat ... Here is a modified bug report ...

that trick does not work for the second table, because it seems that neigher the exporter nor ods understand @i (that is not so important @i is convinient, but not essential)

@I etc are supported.

For example, the test-if table in the previous discussion does have these references and it works

kjambunathan avatar Oct 03 '23 09:10 kjambunathan

rescaling1 should work now.

With regard to rescaling2 ... it works but with a caveat ...

that trick does not work for the second table, because it seems that neigher the exporter nor ods understand @i (that is not so important @i is convinient, but not essential)

@i etc are supported.

For example, the test-if table in the previous discussion does have these references and it works

The rescaling2 example has forked off as #259.

ouboub avatar Oct 03 '23 09:10 ouboub