emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Schlauer <cs-muelleimer-rubbish.bin@arcor.de>
To: emacs-orgmode@gnu.org
Subject: Alignment of numbers in tables with `nan' in some table cells
Date: Sun, 12 Aug 2007 22:33:15 +0200	[thread overview]
Message-ID: <f9nqps$av8$4@sea.gmane.org> (raw)

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

             reply	other threads:[~2007-08-12 20:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-12 20:33 Christian Schlauer [this message]
2007-08-14 13:09 ` Alignment of numbers in tables with `nan' in some table cells Carsten Dominik
2007-08-18  7:50   ` Christian Schlauer
2007-08-20  5:42     ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='f9nqps$av8$4@sea.gmane.org' \
    --to=cs-muelleimer-rubbish.bin@arcor.de \
    --cc=cs-usenet@arcor.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).