Re: [NTG-context] Simplified input for natural tables
looks nice. Aditya Mahajan wrote: On Thu, 12 Mar 2009, Vyatcheslav Yatskovsky wrote: In the same way as Hans wrote them in his exmple. Cool, but will it be included in context source? Or it is too early? I think that such solutions are too fragile. A robust way will be to use a complete mediawiki (or any other markup) parser. It one in lua is available, integrating it to ConTeXt will be easy. If not, we can still have an external file based route. For some time I have been thinking about a module using which I can do \definemarkup[RST][command={pandoc -r rst -w context}] \startRST Write anything here in restructured text syntax here. For example - Two syntaxes for tables_: 1. `Grid tables`_; complete, but complex and verbose:: +++--+ | Header row, column 1 | Header 2 | Header 3 | +++==+ | body row 1, column 1 | column 2 | column 3 | +++--+ | body row 2 | Cells may span| ++---+ 2. `Simple tables`_; easy and compact, but limited:: == == Header row, column 1 Header 2Header 3 == == body row 1, column 1 column 2column 3 body row 2Cells may span columns == \stopRST Such a module will also provide a quick and dirty way of writing simple presentations. Any takers for writings such a module (basically just copying the R module a bit). 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 ___ ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
Am 12.03.2009 um 21:06 schrieb Aditya Mahajan: Cool, but will it be included in context source? Or it is too early? I think that such solutions are too fragile. A robust way will be to use a complete mediawiki (or any other markup) parser. It one in lua is available, integrating it to ConTeXt will be easy. If not, we can still have an external file based route. LaTeX has a package [1] to use wiki markup and it's not to hard to write a package for a small subset of markup. You can use LPeg to parse the input but it's nothing we need in the core. [1] http://www.ctan.org/pub/tex-archive/macros/latex/contrib/nicetext Wolfgang ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
On Thu, 12 Mar 2009, Vyatcheslav Yatskovsky wrote: In the same way as Hans wrote them in his exmple. Cool, but will it be included in context source? Or it is too early? I think that such solutions are too fragile. A robust way will be to use a complete mediawiki (or any other markup) parser. It one in lua is available, integrating it to ConTeXt will be easy. If not, we can still have an external file based route. For some time I have been thinking about a module using which I can do \definemarkup[RST][command={pandoc -r rst -w context}] \startRST Write anything here in restructured text syntax here. For example - Two syntaxes for tables_: 1. `Grid tables`_; complete, but complex and verbose:: +++--+ | Header row, column 1 | Header 2 | Header 3 | +++==+ | body row 1, column 1 | column 2 | column 3 | +++--+ | body row 2 | Cells may span| ++---+ 2. `Simple tables`_; easy and compact, but limited:: == == Header row, column 1 Header 2Header 3 == == body row 1, column 1 column 2column 3 body row 2Cells may span columns == \stopRST Such a module will also provide a quick and dirty way of writing simple presentations. Any takers for writings such a module (basically just copying the R module a bit). 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 ___
Re: [NTG-context] Simplified input for natural tables
In the same way as Hans wrote them in his exmple. Cool, but will it be included in context source? Or it is too early? Best, Vyatcheslav ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
Am 12.03.2009 um 18:14 schrieb Vyatcheslav Yatskovsky: Hello Hraban, Simplified table syntax is much appreciated! Thank you for http://wiki.contextgarden.net/wikitable . However, I cannot understand how to use it. :) In the same way as Hans wrote them in his exmple. \startluacode function commands.wiki_to_table(str) -- wrong namespace str = string.gsub(str,"%^ *[\n\r]","\\NC\\NR\n") str = string.gsub(str,"%^","\\NC ") str = string.gsub(str,"| *[\n\r]","\\NC\\NR\n") str = string.gsub(str,"|","\\NC ") tex.sprint(tex.ctxcatcodes,"\\startTABLE") tex.sprint(tex.ctxcatcodes,str) tex.sprint(tex.ctxcatcodes,"\\stopTABLE") end \stopluacode \def\startwikitable {\bgroup \obeylines \dostartwikitable} \long\def\dostartwikitable#1\stopwikitable {\ctxlua{commands.wiki_to_table([[\detokenize{#1}]])}% \egroup} \starttext \startwikitable ^ Heading 1 ^ Heading 2 ^ | Item 1| Item 2 | | Item 3| Item 4 | \stopwikitable \stoptext Wolfgang ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
Hello Hraban, Simplified table syntax is much appreciated! Thank you for http://wiki.contextgarden.net/wikitable. However, I cannot understand how to use it. :) Best, Vyatcheslav ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
Thank you for the two new table syntaxes! I wikified them: http://wiki.contextgarden.net/wikitable http://wiki.contextgarden.net/TABLE#TABLEs_with_old_table_syntax Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer) PGP.sig Description: Signierter Teil der Nachricht ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
On Sun, Mar 8, 2009 at 4:10 PM, John Devereux wrote: > [...] > I find that writing documents for context - once you get used to it - > is much nicer than using a wordprocessor. > > But the process of entering tables remains tedious and error prone, > compared to e.g. the Word equivalent that many will be used to. Many of my tables are results from some numerical computation, I usually write a short program to print the data in the required ConTeXt/LaTeX format. The others I try to find some similar existing table and update the text. -- George N. White III Head of St. Margarets Bay, Nova Scotia ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
On Sun, Mar 8, 2009 at 19:03, John Devereux wrote: > Hans Hagen writes: > > > [...] > > Hi Hans, > > Is there any possible way to use the wiki-style tables like: > > ^ Heading 1 ^ Heading 2 ^ > | Item 1 | Item 2 | > | Item 3 | Item 4 | > > (Probably with some wrapper) > > Perhaps this boils down to asking if it is possible to (re)define > "special" characters, within a region of text. Hans already answered your question for mkiv. To a certain degree that's already implemented in the database module that also works with mkii (http://wiki.contextgarden.net/m-database) and sometimes a bit buggy, but it works. You may take a look at that one. Mojca ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
Wolfgang Schuster wrote: \long\def\dododoTABLENC#1\NC {\ifconditional\inTABLEnc\else\settrue\inTABLEnc\parseTR[][]\fi \dodoubleempty\parseTD#1\eTD\NC} I want to be able to give argument with \NC too, it's important for me to be able to use spanned columns/rows in the simple form. i had that but then considered it kind of contraditing the simple setup anyhow, i changed it - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
On Sun, Mar 8, 2009 at 5:58 PM, Hans Hagen wrote: > Aditya Mahajan wrote: >> >> 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. > > less code and more efficient too ... can you test this? > > \def\startTABLE > {\dosingleempty\dostartTABLE} > > \def\dostartTABLE[#1]% > {\bgroup > \bTABLE[#1]% > \let\NC\doTABLENC > \let\NR\doTABLENR > \let\bTR\relax > \let\bTD\relax > \let\bTH\relax > \let\bTN\relax} > > \def\stopTABLE > {\eTABLE > \egroup} > > \newconditional\inTABLEnc > > \unexpanded\def\doTABLENR > {\eTR > \setfalse\inTABLEnc} > > \unexpanded\def\doTABLENC > {\futurelet\next\dodoTABLENC} > > \def\dodoTABLENC > {\ifx\next\doTABLENR \else > \expandafter\dododoTABLENC > \fi} > > \long\def\dododoTABLENC#1\NC > {\ifconditional\inTABLEnc\else\settrue\inTABLEnc\parseTR[][]\fi > \parseTD[][]#1\eTD\NC} Can you change this to \long\def\dododoTABLENC#1\NC {\ifconditional\inTABLEnc\else\settrue\inTABLEnc\parseTR[][]\fi \dodoubleempty\parseTD#1\eTD\NC} I want to be able to give argument with \NC too, it's important for me to be able to use spanned columns/rows in the simple form. Wolfgang ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
Hans Hagen writes: > John Devereux wrote: >> Hans Hagen writes: >> >> >> [...] >> >> Hi Hans, >> >> Is there any possible way to use the wiki-style tables like: >> >> ^ Heading 1 ^ Heading 2 ^ >> | Item 1| Item 2 | >> | Item 3| Item 4 | >> >> (Probably with some wrapper) >> >> Perhaps this boils down to asking if it is possible to (re)define >> "special" characters, within a region of text. > > doing that in the running text is asking for troubles (catcode mess) > > if there is real interest in that kind of stuff we can make a module > that does something > > \starttext > > \startluacode > function commands.wiki_to_table(str) -- wrong namespace > str = string.gsub(str,"%^ *[\n\r]","\\NC\\NR\n") > str = string.gsub(str,"%^","\\NC ") > str = string.gsub(str,"| *[\n\r]","\\NC\\NR\n") > str = string.gsub(str,"|","\\NC ") > tex.sprint(tex.ctxcatcodes,"\\startTABLE") > tex.sprint(tex.ctxcatcodes,str) > tex.sprint(tex.ctxcatcodes,"\\stopTABLE") > end > \stopluacode > > \def\startwikitable > {\bgroup >\obeylines >\dostartwikitable} > > \long\def\dostartwikitable#1\stopwikitable > {\ctxlua{commands.wiki_to_table([[\detokenize{#1}]])}% >\egroup} > > \startwikitable > ^ Heading 1 ^ Heading 2 ^ > | Item 1| Item 2 | > | Item 3| Item 4 | > \stopwikitable > > \startTABLE > \NC Text 1 \NC Text 2 \NC \NR > \NC Text 3 \NC Text 4 \NC \NR > \stopTABLE > > \stoptext That appears to be exactly what I was after! (Sorry I don't have MKIV set up right now but will try it when I can). I don't know if it is of general interest. I find that writing documents for context - once you get used to it - is much nicer than using a wordprocessor. But the process of entering tables remains tedious and error prone, compared to e.g. the Word equivalent that many will be used to. -- John Devereux ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
John Devereux wrote: Hans Hagen writes: [...] Hi Hans, Is there any possible way to use the wiki-style tables like: ^ Heading 1 ^ Heading 2 ^ | Item 1| Item 2 | | Item 3| Item 4 | (Probably with some wrapper) Perhaps this boils down to asking if it is possible to (re)define "special" characters, within a region of text. doing that in the running text is asking for troubles (catcode mess) if there is real interest in that kind of stuff we can make a module that does something \starttext \startluacode function commands.wiki_to_table(str) -- wrong namespace str = string.gsub(str,"%^ *[\n\r]","\\NC\\NR\n") str = string.gsub(str,"%^","\\NC ") str = string.gsub(str,"| *[\n\r]","\\NC\\NR\n") str = string.gsub(str,"|","\\NC ") tex.sprint(tex.ctxcatcodes,"\\startTABLE") tex.sprint(tex.ctxcatcodes,str) tex.sprint(tex.ctxcatcodes,"\\stopTABLE") end \stopluacode \def\startwikitable {\bgroup \obeylines \dostartwikitable} \long\def\dostartwikitable#1\stopwikitable {\ctxlua{commands.wiki_to_table([[\detokenize{#1}]])}% \egroup} \startwikitable ^ Heading 1 ^ Heading 2 ^ | Item 1| Item 2 | | Item 3| Item 4 | \stopwikitable \startTABLE \NC Text 1 \NC Text 2 \NC \NR \NC Text 3 \NC Text 4 \NC \NR \stopTABLE \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
Hans Hagen writes: [...] Hi Hans, Is there any possible way to use the wiki-style tables like: ^ Heading 1 ^ Heading 2 ^ | Item 1| Item 2 | | Item 3| Item 4 | (Probably with some wrapper) Perhaps this boils down to asking if it is possible to (re)define "special" characters, within a region of text. -- John Devereux ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
Aditya Mahajan wrote: 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. less code and more efficient too ... can you test this? \def\startTABLE {\dosingleempty\dostartTABLE} \def\dostartTABLE[#1]% {\bgroup \bTABLE[#1]% \let\NC\doTABLENC \let\NR\doTABLENR \let\bTR\relax \let\bTD\relax \let\bTH\relax \let\bTN\relax} \def\stopTABLE {\eTABLE \egroup} \newconditional\inTABLEnc \unexpanded\def\doTABLENR {\eTR \setfalse\inTABLEnc} \unexpanded\def\doTABLENC {\futurelet\next\dodoTABLENC} \def\dodoTABLENC {\ifx\next\doTABLENR \else \expandafter\dododoTABLENC \fi} \long\def\dododoTABLENC#1\NC {\ifconditional\inTABLEnc\else\settrue\inTABLEnc\parseTR[][]\fi \parseTD[][]#1\eTD\NC} watch the relaxing of the b commands, so that we catch mixed usage Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ 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 ___
Re: [NTG-context] Simplified input for natural tables
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, %Dversion=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 ___
[NTG-context] Simplified input for natural tables
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, %Dversion=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 ___