ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Mojca Miklavec" <mojca.miklavec.lists@gmail.com>
Subject: Re: Feature request: Creating tables from (tab-separated) values
Date: Sun, 23 Apr 2006 13:13:05 +0200	[thread overview]
Message-ID: <6faad9f00604230413v6e007ba8q93396b28bae5a271@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0604221957290.30824@gaston.pm>

On 4/22/06, Peter Münster wrote:
> On Sat, 22 Apr 2006, Mojca Miklavec wrote:
>
> > - [with luaTeX in mind] calculating sums of rows & columns & other
> > Excel-like calculations & references accross tables ;) - well, that
> > one wasn't meant seriously.
>
> Hello Mojca,
> should be possible even without luaTeX:
>
> \input realcalc % can be found on CTAN

Thanks for the pointer! I've never used this one so far.

> \def\SumFF{0}
> \def\SumEUR{0}
>
> \def\AddEUR#1{\Radd\SumEUR\SumEUR{#1}%
>   \Rmul\R{#1}{6.55957}\Radd\R\R{0.005}\Rtrunc\R2\R
>   \Radd\SumFF\SumFF\R \bTR \bTD\eTD \bTD#1\eTD \expanded{\bTD\R\eTD} \eTR}
>
> \def\PrintSums{\bTR \bTD Sums: \eTD
>   \bTD\Rtrunc\SumEUR2\SumEUR \SumEUR\eTD
>   \bTD\Rtrunc\SumFF2\SumFF   \SumFF \eTD \eTR}
>
> \starttext
> \setupTABLE[r][each][align=flushright]
> \setupTABLE[r][1][align=middle]
> \bTABLE
> \bTR \bTH\eTH \bTH Euro \eTH \bTH FF \eTH \eTR
> \AddEUR{1.23}
> \AddEUR{2.34}
> \AddEUR{45.67}
> \PrintSums
> \eTABLE
> \stoptext
>
> With LaTeX, you can even replace the . by a , :

Stupid me! I forgot about the following trick
    \uccode`.=`,
    \WORD{3.14}

(It can be surely done without using \WORD, but that was the easiest
way to recall it from another evil example that Hans sent me some time
ago.)

Mojca

  reply	other threads:[~2006-04-23 11:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-22  2:02 Mojca Miklavec
2006-04-22 18:02 ` Peter Münster
2006-04-23 11:13   ` Mojca Miklavec [this message]
2006-04-23 16:31     ` Peter Münster
2006-04-23 17:15 ` Taco Hoekwater

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

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

  git send-email \
    --in-reply-to=6faad9f00604230413v6e007ba8q93396b28bae5a271@mail.gmail.com \
    --to=mojca.miklavec.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    /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.
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 NNTP newsgroup(s).