ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: Simplified input for natural tables
       [not found] <mailman.19.1236882597.12697.ntg-context@ntg.nl>
@ 2009-03-12 19:51 ` Vyatcheslav Yatskovsky
  2009-03-12 20:06   ` Aditya Mahajan
  0 siblings, 1 reply; 17+ messages in thread
From: Vyatcheslav Yatskovsky @ 2009-03-12 19:51 UTC (permalink / raw)
  To: ntg-context

>
> 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-12 19:51 ` Simplified input for natural tables Vyatcheslav Yatskovsky
@ 2009-03-12 20:06   ` Aditya Mahajan
  2009-03-12 20:19     ` Wolfgang Schuster
  2009-03-13 22:13     ` Mohamed Bana
  0 siblings, 2 replies; 17+ messages in thread
From: Aditya Mahajan @ 2009-03-12 20:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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 2    Header 3
          ====================  ==========  ==========
          body row 1, column 1  column 2    column 3
          body row 2            Cells 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-12 20:06   ` Aditya Mahajan
@ 2009-03-12 20:19     ` Wolfgang Schuster
  2009-03-13 22:13     ` Mohamed Bana
  1 sibling, 0 replies; 17+ messages in thread
From: Wolfgang Schuster @ 2009-03-12 20:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-12 20:06   ` Aditya Mahajan
  2009-03-12 20:19     ` Wolfgang Schuster
@ 2009-03-13 22:13     ` Mohamed Bana
  1 sibling, 0 replies; 17+ messages in thread
From: Mohamed Bana @ 2009-03-13 22:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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 2    Header 3
>          ====================  ==========  ==========
>          body row 1, column 1  column 2    column 3
>          body row 2            Cells 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-12 17:14 Vyatcheslav Yatskovsky
@ 2009-03-12 18:05 ` Wolfgang Schuster
  0 siblings, 0 replies; 17+ messages in thread
From: Wolfgang Schuster @ 2009-03-12 18:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
@ 2009-03-12 17:14 Vyatcheslav Yatskovsky
  2009-03-12 18:05 ` Wolfgang Schuster
  0 siblings, 1 reply; 17+ messages in thread
From: Vyatcheslav Yatskovsky @ 2009-03-12 17:14 UTC (permalink / raw)
  To: hraban, ntg-context

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-09 13:35           ` George N. White III
@ 2009-03-12 10:57             ` Henning Hraban Ramm
  0 siblings, 0 replies; 17+ messages in thread
From: Henning Hraban Ramm @ 2009-03-12 10:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 310 bytes --]

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)


[-- Attachment #1.2: Signierter Teil der Nachricht --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-08 19:10         ` John Devereux
@ 2009-03-09 13:35           ` George N. White III
  2009-03-12 10:57             ` Henning Hraban Ramm
  0 siblings, 1 reply; 17+ messages in thread
From: George N. White III @ 2009-03-09 13:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, Mar 8, 2009 at 4:10 PM, John Devereux <john@devereux.me.uk> 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 <aa056@chebucto.ns.ca>
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-08 18:03     ` John Devereux
  2009-03-08 18:36       ` Hans Hagen
@ 2009-03-09 12:15       ` Mojca Miklavec
  1 sibling, 0 replies; 17+ messages in thread
From: Mojca Miklavec @ 2009-03-09 12:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, Mar 8, 2009 at 19:03, John Devereux wrote:
> Hans Hagen <pragma@wxs.nl> 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-08 19:26     ` Wolfgang Schuster
@ 2009-03-08 19:50       ` Hans Hagen
  0 siblings, 0 replies; 17+ messages in thread
From: Hans Hagen @ 2009-03-08 19:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-08 16:58   ` Hans Hagen
  2009-03-08 18:03     ` John Devereux
@ 2009-03-08 19:26     ` Wolfgang Schuster
  2009-03-08 19:50       ` Hans Hagen
  1 sibling, 1 reply; 17+ messages in thread
From: Wolfgang Schuster @ 2009-03-08 19:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, Mar 8, 2009 at 5:58 PM, Hans Hagen <pragma@wxs.nl> 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-08 18:36       ` Hans Hagen
@ 2009-03-08 19:10         ` John Devereux
  2009-03-09 13:35           ` George N. White III
  0 siblings, 1 reply; 17+ messages in thread
From: John Devereux @ 2009-03-08 19:10 UTC (permalink / raw)
  To: ntg-context

Hans Hagen <pragma@wxs.nl> writes:

> John Devereux wrote:
>> Hans Hagen <pragma@wxs.nl> 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-08 18:03     ` John Devereux
@ 2009-03-08 18:36       ` Hans Hagen
  2009-03-08 19:10         ` John Devereux
  2009-03-09 12:15       ` Mojca Miklavec
  1 sibling, 1 reply; 17+ messages in thread
From: Hans Hagen @ 2009-03-08 18:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users

John Devereux wrote:
> Hans Hagen <pragma@wxs.nl> 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-08 16:58   ` Hans Hagen
@ 2009-03-08 18:03     ` John Devereux
  2009-03-08 18:36       ` Hans Hagen
  2009-03-09 12:15       ` Mojca Miklavec
  2009-03-08 19:26     ` Wolfgang Schuster
  1 sibling, 2 replies; 17+ messages in thread
From: John Devereux @ 2009-03-08 18:03 UTC (permalink / raw)
  To: ntg-context

Hans Hagen <pragma@wxs.nl> 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-08 16:34 ` Aditya Mahajan
@ 2009-03-08 16:58   ` Hans Hagen
  2009-03-08 18:03     ` John Devereux
  2009-03-08 19:26     ` Wolfgang Schuster
  0 siblings, 2 replies; 17+ messages in thread
From: Hans Hagen @ 2009-03-08 16:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Simplified input for natural tables
  2009-03-08 15:24 Wolfgang Schuster
@ 2009-03-08 16:34 ` Aditya Mahajan
  2009-03-08 16:58   ` Hans Hagen
  0 siblings, 1 reply; 17+ messages in thread
From: Aditya Mahajan @ 2009-03-08 16:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Simplified input for natural tables
@ 2009-03-08 15:24 Wolfgang Schuster
  2009-03-08 16:34 ` Aditya Mahajan
  0 siblings, 1 reply; 17+ messages in thread
From: Wolfgang Schuster @ 2009-03-08 15:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2009-03-13 22:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.19.1236882597.12697.ntg-context@ntg.nl>
2009-03-12 19:51 ` Simplified input for natural tables Vyatcheslav Yatskovsky
2009-03-12 20:06   ` Aditya Mahajan
2009-03-12 20:19     ` Wolfgang Schuster
2009-03-13 22:13     ` Mohamed Bana
2009-03-12 17:14 Vyatcheslav Yatskovsky
2009-03-12 18:05 ` Wolfgang Schuster
  -- strict thread matches above, loose matches on Subject: below --
2009-03-08 15:24 Wolfgang Schuster
2009-03-08 16:34 ` Aditya Mahajan
2009-03-08 16:58   ` Hans Hagen
2009-03-08 18:03     ` John Devereux
2009-03-08 18:36       ` Hans Hagen
2009-03-08 19:10         ` John Devereux
2009-03-09 13:35           ` George N. White III
2009-03-12 10:57             ` Henning Hraban Ramm
2009-03-09 12:15       ` Mojca Miklavec
2009-03-08 19:26     ` Wolfgang Schuster
2009-03-08 19:50       ` Hans Hagen

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).