Hi Karl, hi all

@maintainers:
According to the below I tried to improve the Org manual with the
attached patch, please review and apply.

On Sun, Oct 6, 2013 at 1:30 PM, Karl Voit <devn...@karl-voit.at> wrote:
> The things I learned about referencing other tables I documented in [1].
>
> Maybe you'll find it handy as a reference to referencing tables :-)
>
>   1. 
> https://raw.github.com/novoid/org-mode-workshop/master/featureshow/org-mode-teaser.org
>      search for "referencing example with detailed explanation"

Yes, with all the explanations of how the formulas work your github
novoid/org-mode-workshop contains a very nice spreadsheet
documentation, for more than just referencing remote tables. Can you
please link the section here with mentioning that it contains
explanations of how the formulas work?:
http://orgmode.org/worg/org-tutorials/index.html

Your new example in github novoid/org-mode-workshop with
@2=remote(Income2012h, @3$$#)
- motivated by my example in the current Org manual
- that interprets text as a Calc algebraic expression, which is
  subject to reformatting
reminded me of that just copying fields is better done with a Lisp
formula "'(identity [...])", see attached patch for the Org manual.

Michael
From a3efc3edd94ccc21544792ddde4a6c54284100ce Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.br...@gmail.com>
Date: Sun, 6 Oct 2013 19:01:15 +0200
Subject: [PATCH] Improve manual for table formulas

* doc/org.texi (Field coordinates in formulas): Rephrase and add an
example with a Lisp formula to copy from remote table.
---
 doc/org.texi | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 0271d70..0a90d33 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -2551,21 +2551,28 @@ for Calc}.
 @cindex row, of field coordinates
 @cindex column, of field coordinates
 
-For Calc formulas and Lisp formulas @code{@@#} and @code{$#} can be used to
-get the row or column number of the field where the formula result goes.
-The traditional Lisp formula equivalents are @code{org-table-current-dline}
-and @code{org-table-current-column}.  Examples:
+One of the very first actions during evaluation of Calc formulas and Lisp
+formulas is to substitute @code{@@#} and @code{$#} in the formula with the
+row or column number of the field where the current result will go to.  The
+traditional Lisp formula equivalents are @code{org-table-current-dline} and
+@code{org-table-current-column}.  Examples:
 
-@example
-if(@@# % 2, $#, string(""))   @r{column number on odd lines only}
-$3 = remote(FOO, @@@@#$2)      @r{copy column 2 from table FOO into}
-                             @r{column 3 of the current table}
-@end example
+@table @code
+@item if(@@# % 2, $#, string(""))
+Insert column number on odd rows, set field to empty on even rows.
+@item $2 = '(identity remote(FOO, @@@@#$1))
+Copy text or values of each row of column 1 of the table named @code{FOO}
+into column 2 of the current table.
+@item @@3 = 2 * remote(FOO, @@1$$#)
+Insert the doubled value of each column of row 1 of the table named
+@code{FOO} into row 3 of the current table.
+@end table
 
-@noindent For the second example, table FOO must have at least as many rows
-as the current table.  Note that this is inefficient@footnote{The computation 
time scales as
-O(N^2) because table FOO is parsed for each field to be copied.} for large
-number of rows.
+@noindent For the second/third example, the table named @code{FOO} must have
+at least as many rows/columns as the current table.  Note that this is
+inefficient@footnote{The computation time scales as O(N^2) because the table
+named @code{FOO} is parsed for each field to be read.} for large number of
+rows/columns.
 
 @subsubheading Named references
 @cindex named references
-- 
1.7.12.4 (Apple Git-37)

Reply via email to