From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/48090 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Simplified input for natural tables Date: Sun, 8 Mar 2009 16:24:06 +0100 Message-ID: <1C61EC31-CF0E-4A26-9EA9-2B26C14116CD@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset="us-ascii"; Format="flowed"; DelSp="yes" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1236525988 24805 80.91.229.12 (8 Mar 2009 15:26:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Mar 2009 15:26:28 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Mar 08 16:27:44 2009 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 lo.gmane.org with esmtp (Exim 4.50) id 1LgKuk-0004cG-7D for gctc-ntg-context-518@m.gmane.org; Sun, 08 Mar 2009 16:27:42 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6418F1FB49; Sun, 8 Mar 2009 16:26:18 +0100 (CET) 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 31170-03-2; Sun, 8 Mar 2009 16:25:23 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 28D141FA4C; Sun, 8 Mar 2009 16:25:23 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 8C5741FA41 for ; Sun, 8 Mar 2009 16:25:21 +0100 (CET) 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 31170-03 for ; Sun, 8 Mar 2009 16:24:54 +0100 (CET) Original-Received: from filter3-til.mf.surf.net (filter3-til.mf.surf.net [194.171.167.219]) by ronja.ntg.nl (Postfix) with ESMTP id 7B1201FA4C for ; Sun, 8 Mar 2009 16:24:54 +0100 (CET) Original-Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.159]) by filter3-til.mf.surf.net (8.13.8/8.13.8/Debian-3) with ESMTP id n28FOrk2031784 for ; Sun, 8 Mar 2009 16:24:53 +0100 Original-Received: by fg-out-1718.google.com with SMTP id e21so714120fga.8 for ; Sun, 08 Mar 2009 08:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :content-type:content-transfer-encoding:mime-version:subject:date :x-mailer; bh=49lt8yWbiCVhxH0i6uW5PEZnj3HoxFC0ouEJ9DuVyB0=; b=lfJtxr0UF8F9f+hH2BhqORUSLfT9TXXv6NjAFLtnSgOrzCALW4VIXkkbLk8xMYVR7B iEOGa5iYS9eIhmDxove7TlIjAJ8KNjnzB66dxkx/yL4I5FzMXvq8m1pJchiGYECXIPbi aw2cNbTIU/gWhXm2zhPCeTNlITsOY+KZtkDLw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer; b=CFRINJCXjK6TsN8wsxh9OL5FUXB/U45CGZ+AffCLVFnmi8KLdmSCOeGMpg2/W6j2dO qpo1cTMIZ4H+LoBr3IYjofBV8LbCOVsmTYR00DXcDqxAzZRYTvSugJz9mfPp78peuoei VeGtq/Vl6hHZAr1k7ja35qXfSRCKExqw/zRiA= Original-Received: by 10.86.33.10 with SMTP id g10mr3281185fgg.56.1236525893484; Sun, 08 Mar 2009 08:24:53 -0700 (PDT) Original-Received: from ?10.40.135.55? ([82.113.121.152]) by mx.google.com with ESMTPS id e11sm2312214fga.10.2009.03.08.08.24.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 08 Mar 2009 08:24:53 -0700 (PDT) X-Mailer: Apple Mail (2.930.3) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=72.14.220.159; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 190259453 - c092dc4ce8af X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.219 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.11 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:48090 Archived-At: Hi Hans, natural tables are perfect to create tables with a fixed size for the cells but the syntax requires sometimes a lot of typing for small content and takes to many lines of code in the document. I wrote a while ago a simple wrapper to use a table/tabulate like syntax for the input, what I don't like is to load a extra module for just a few lines of code and I think they can be integrated in the core-ntb code. Wolfgang %D \module %D [ file=wolf-tab, %D version=2007.01.26, %D title=\CONTEXT\ User Module, %D subtitle=New Tables, %D author=Wolfgang Schuster, %D date=\currentdate, %D copyright=Wolfgang Schuster] \writestatus{loading}{Context User Module / New Tables} \unprotect %D This module provides an easy way to use natural in a similiar %D way as the older table module (based on the \TABLE\ macros) and %D the newer tabulate module. %D %D You can see the advantage in the following table, once created %D with the new macros and once with the normal macros provided %D with the natural table module. %D %D Let us start with the original macros: %D %D \starttyping %D \bTABLE %D \bTR %D \bTD Text 1 \eTD %D \bTD Text 2 \eTD %D \eTR %D \bTR %D \bTD Text 3 \eTD %D \bTD Text 4 \eTD %D \eTR %D \eTABLE %D \stoptyping %D %D and now with my new macros: %D %D \starttyping %D \startTABLE %D \NC Text 1 \NC Text 2 \NC\NR %D \NC Text 3 \NC Text 4 \NC\NR %D \stopTABLE %D \stoptyping \def\startTABLE {\dosingleempty\dostartTABLE} \def\dostartTABLE[#1]% {\bgroup \def\NC{\parseNC} \bTABLE[#1]} \def\stopTABLE {\eTABLE \egroup} \def\parseNC#1\NR {\bTR \processNC#1\stopNC\NC} \def\stopNC{\stopNC} \def\processNC#1\NC% {\def\temp{#1}% \ifx\temp\stopNC \eTR \else \bTD#1\eTD% \expandafter\processNC \fi} % shorter but did not work when external files are loaded in the table, % e.g. \bTD \input knuth \eTD. % %\def\parseNC#1\NC\NR % {\bTR % \processseparatedlist[#1][\NC]\processNC % \eTR} % %\def\processNC#1% % {\bTD#1\eTD} %D I used the same mechanism as in \type{core-ntb.tex} to allow different %D headers on the first and the following pages. The only changes ist that %D I renamed the commands from \tex{bTABLE...} to \tex{startTABLE...} and %D from \tex{eTABLE...} to \tex{stopTABLE...} to match the start and stop %D pair at begin and end of the table. \long\def\startTABLEhead{\dosingleempty\dostartTABLEhead} \long\def\startTABLEnext{\dosingleempty\dostartTABLEnext} \long\def\startTABLEbody{\dosingleempty\dostartTABLEbody} \long\def\startTABLEfoot{\dosingleempty\dostartTABLEfoot} \long\def\dostartTABLEhead[#1]#2\stopTABLEhead{\appendtoks \doTABLEsection[#1]{#2}\to\TBLhead} \long\def\dostartTABLEnext[#1]#2\stopTABLEnext{\appendtoks \doTABLEsection[#1]{#2}\to\TBLnext} \long\def\dostartTABLEbody[#1]#2\stopTABLEbody{\appendtoks \doTABLEsection[#1]{#2}\to\TBLbody} \long\def\dostartTABLEfoot[#1]#2\stopTABLEfoot{\appendtoks \doTABLEsection[#1]{#2}\to\TBLfoot} %D \startbuffer %D \startTABLE %D \NC Text 1 \NC Text 2 \NC\NR %D \NC Text 3 \NC Text 4 \NC\NR %D \stopTABLE %D \stopbuffer %D %D My example from the begin of this module %D %D \typebuffer %D %D looks like this: %D %D \startlinecorrection %D \getbuffer %D \stoplinecorrection \protect \endinput ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________