From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/27393 Path: news.gmane.org!not-for-mail From: =?ISO-8859-15?Q?Peter_M=FCnster?= Newsgroups: gmane.comp.tex.context Subject: Re: Feature request: Creating tables from (tab-separated) values Date: Sat, 22 Apr 2006 20:02:45 +0200 (CEST) Message-ID: References: <6faad9f00604211902m5c88d10apcd5c208f1825f51c@mail.gmail.com> Reply-To: ntg-context@ntg.nl NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1145729025 1526 80.91.229.2 (22 Apr 2006 18:03:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 22 Apr 2006 18:03:45 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sat Apr 22 20:03:43 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1FXMSL-0005YG-JJ for gctc-ntg-context-518@m.gmane.org; Sat, 22 Apr 2006 20:03:41 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 0B25E12795; Sat, 22 Apr 2006 20:03:41 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20263-05; Sat, 22 Apr 2006 20:03:35 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 8CE8A1278F; Sat, 22 Apr 2006 20:03:35 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id AC7371278F for ; Sat, 22 Apr 2006 20:03:33 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17545-07 for ; Sat, 22 Apr 2006 20:03:32 +0200 (CEST) Original-Received: from smtp.cegetel.net (mf00.sitadelle.com [212.94.174.67]) by ronja.ntg.nl (Postfix) with SMTP id B43321278A for ; Sat, 22 Apr 2006 20:03:32 +0200 (CEST) Original-Received: from gaston.pm (unknown [84.7.255.206]) by smtp.cegetel.net (Postfix) with ESMTP id ADF901A4530 for ; Sat, 22 Apr 2006 20:03:31 +0200 (CEST) Original-Received: by gaston.pm (Postfix, from userid 500) id 419E913C3C8; Sat, 22 Apr 2006 20:02:45 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by gaston.pm (Postfix) with ESMTP id 3D086148183 for ; Sat, 22 Apr 2006 20:02:45 +0200 (CEST) X-X-Sender: peter@gaston.pm Original-To: mailing list for ConTeXt users In-Reply-To: <6faad9f00604211902m5c88d10apcd5c208f1825f51c@mail.gmail.com> X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:27393 Archived-At: 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 \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 , : \documentclass{article} \usepackage{dcolumn} \input{realcalc}% on CTAN \newcommand*\cc[1]{\multicolumn{1}{c}{#1}} \def\scanwert\ignorespaces#1\unskip{\gdef\WERT{#1}#1} \begin{document} \begin{tabular}{>{\scanwert}D{.}{,}{-1}% >{\Rmul\res\WERT{6.55957}\Radd\res\res{0.005}\Rtrunc\res2\res\res}% D{.}{,}{-1}}% \cc{Euro} & \cc{FF}\\\hline 20.33 & \\ 20.3 & \\ 20 & \\ 14.46 & \end{tabular} \end{document} Cheers, Peter -- http://pmrb.free.fr/contact/