From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/48092 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: Simplified input for natural tables Date: Sun, 8 Mar 2009 12:34:18 -0400 (EDT) Message-ID: References: <1C61EC31-CF0E-4A26-9EA9-2B26C14116CD@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1236530153 3777 80.91.229.12 (8 Mar 2009 16:35:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Mar 2009 16:35:53 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Mar 08 17:37:09 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 1LgLzw-0007rG-J8 for gctc-ntg-context-518@m.gmane.org; Sun, 08 Mar 2009 17:37:08 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 093C51FADC; Sun, 8 Mar 2009 17:35:44 +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 12917-02-13; Sun, 8 Mar 2009 17:35:07 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 1CF5D1FADB; Sun, 8 Mar 2009 17:35:07 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id CFE1B1FADB for ; Sun, 8 Mar 2009 17:35:05 +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 12917-02-12 for ; Sun, 8 Mar 2009 17:34:56 +0100 (CET) Original-Received: from filter2-til.mf.surf.net (filter2-til.mf.surf.net [194.171.167.218]) by ronja.ntg.nl (Postfix) with ESMTP id ABE3E1FA41 for ; Sun, 8 Mar 2009 17:34:56 +0100 (CET) Original-Received: from hackers.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.81]) by filter2-til.mf.surf.net (8.13.8/8.13.8/Debian-3) with ESMTP id n28GYsf1010374 for ; Sun, 8 Mar 2009 17:34:55 +0100 Original-Received: FROM [192.168.2.8] (c-71-234-195-113.hsd1.ct.comcast.net [71.234.195.113]) BY hackers.mr.itd.umich.edu ID 49B3F3AD.1E615.17512 ; 8 Mar 2009 12:34:53 -0400 In-Reply-To: <1C61EC31-CF0E-4A26-9EA9-2B26C14116CD@gmail.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.14.81; country=US; region=MI; city=Ann Arbor; postalcode=48109; latitude=42.2923; longitude=-83.7145; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.2923,-83.7145&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 190273866 - ca839ea4398d X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.218 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:48092 Archived-At: On Sun, 8 Mar 2009, Wolfgang Schuster wrote: > 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. Only yesterday I went over my old mails to search for this and hoped that it would be available as a module :) Just a few comments. > %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} To avoid potential conflicts, can you name \parseNC as \paseTABLENC, \processNC as \processTABLENC, and \stopNC as \stopTABLENC. > \def\stopNC{\stopNC} > > \def\processNC#1\NC% > {\def\temp{#1}% How about \currentTABLEcell instead of \temp? > \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 > Thanks, Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________