From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Schlauer Subject: Alignment of numbers in tables with `nan' in some table cells Date: Sun, 12 Aug 2007 22:33:15 +0200 Message-ID: Reply-To: cs-usenet@arcor.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IKK9S-0003u5-JY for emacs-orgmode@gnu.org; Sun, 12 Aug 2007 16:35:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IKK9R-0003rx-L6 for emacs-orgmode@gnu.org; Sun, 12 Aug 2007 16:35:05 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IKK9R-0003rc-CO for emacs-orgmode@gnu.org; Sun, 12 Aug 2007 16:35:05 -0400 Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IKK9R-0005Br-0l for emacs-orgmode@gnu.org; Sun, 12 Aug 2007 16:35:05 -0400 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1IKK9O-0005Zx-BI for emacs-orgmode@gnu.org; Sun, 12 Aug 2007 22:35:02 +0200 Received: from finn.gmane.org ([80.91.229.4]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 12 Aug 2007 22:35:02 +0200 Received: from cs-usenet by finn.gmane.org with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 12 Aug 2007 22:35:02 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hello Carsten, hello list! This is about alignment of numbers in tables. Say I have three columns with data (the first three columns). Then I do calculations on them (the last two columns). Columns 2 and 3 are "complete" -- I have data in each field, so there is always some useful result in column 4, as $4=$2-$3. But column 5 is $5=$1-$4, and in column 1 there are some empty fields where data are missing, unfortunately. That leads to a negative value of -6 in line 3, column 5: | data 1 | data 2 | data 3 | result 1 | result 2 | |--------+--------+--------+----------+----------| | 23 | 25 | 17 | 8 | 15 | | | 24 | 18 | 6 | -6 | #+TBLFM: $4=$2-$3::$5=$1-$4 Now, a negative value doesn't make sense in my real table. So instead of printing a nonsensical value, I'd prefer something else there. I remembered that MATLAB has `NaN', and Calc has that, too: `nan', see (info "(calc)Infinities"). So I put `nan' in line 3, column 1, and recalculate the above table: | data 1 | data 2 | data 3 | result 1 | result 2 | |--------+--------+--------+----------+----------| | 23 | 25 | 17 | 8 | 15 | | nan | 24 | 18 | 6 | nan | #+TBLFM: $4=$2-$3::$5=$1-$4 It's almost perfect! It is clear that a result for column 5 in line 3 does not exist as there are no data in column 1 of that line. The only thing that is not perfect is that the alignment in columns 1 and 5 is messed up due to `nan'. Could this be fixed? Regards, -- Christian Schlauer