I quickly came up with something myself.  Unfortunately, it involves 
overloading of the original xtables.  Perhaps there is a better way but it 
works.  I am happy to hear your opinions!

\unprotect

% Overload tabl_x_start_table
\unexpanded\def\tabl_x_start_table[#settings]% maybe two arguments: 
[tag][settings] | [tag] | [settings]
  {\bgroup
   \let\NC\tabl_xte_start_nc
   \let\NR\tabl_xte_start_nr
   \tabl_x_prepare{#settings}%
   \edef\tabl_x_current_buffer{\tabl_x_default_buffer}%
   
\buff_pickup{\tabl_x_current_buffer}{startxtable}{stopxtable}\relax\tabl_x_process\zerocount}

% xtable extensions
\newconditional\c_tabl_xte_in_nc

\unexpanded\def\tabl_xte_start_nr
  {\stopxrow
   \setfalse\c_tabl_xte_in_nc}

\unexpanded\def\tabl_xte_start_nc
  {\futurelet\next\tabl_xte_start_nc_indeed}

\def\tabl_xte_start_nc_indeed
  {\ifx\next\tabl_xte_start_nr \else
     \expandafter\tabl_xte_start_nc_finish
   \fi}

\def\tabl_xte_start_nc_finish#1\NC
  {\ifconditional\c_tabl_xte_in_nc \else
     \settrue\c_tabl_xte_in_nc
     \startxrow[]%
   \fi
   \startxcell#1\stopxcell\NC}

\protect

\starttext

\startxtable[align={lohi,middle}]
  \NC OSI-Schicht            \NC[nx=6] Umsetzung \NC\NR
  \NC Anwendungsschicht      \NC[nx=2,ny=3] SOME/I \NC[nx=2,ny=3] AVB/TSN 
\NC[nx=2,ny=3] DoIP \NC\NR
  \NC Darstellungsschicht    \NC\NR
  \NC Sitzungsschicht        \NC\NR
  \NC Transportschicht       \NC[nx=3] TCP \NC[nx=3] UDP \NC\NR   
  \NC Vermittlungsschicht    \NC[nx=3] IPv4 \NC[nx=3] IPv6 \NC\NR
  \NC Sicherungsschicht      \NC[nx=6] Ethernet \NC\NR
  \NC Bitübertragungsschicht \NC[nx=2] 100BASE-TX \NC[nx=2] 100BASE-T \NC[nx=2] 
1000BASE-T \NC\NR
\stopxtable

\stoptext

On 03/08/2017 04:29 PM, Henri Menke wrote:
> Dear devs,
> 
> Natural Tables are quite handy but their syntax is a little verbose.
> 
> \bTABLE
>   \bTR
>     \bTD ... \eTD
>   \eTR
> \eTABLE
> 
> There exist nice extensions which make the format less verbose by mapping
> 
> \startTABLE
>   \NC ... \NR\NR
> \stopTABLE
> 
> back to the original macros.
> 
> The new method for tables, called xtables, is faster and seems to have less 
> problems than Natural Tables.  However, the syntax is even more verbose
> 
> \startxtable
>   \startxrow
>     \startxcell ... \stopxcell
>   \stopxrow
> \stopxtable
> 
> Can we have similar abbreviations as for Natural Tables?  I am thinking of 
> something like
> 
> \startXTABLE
>   \NC ... \NR\NR
> \stopXTABLE
> 
> I tried myself rewriting tabl-nte.mkiv for xtables but it is not 
> straightforward.
> 
> What do you think of this proposal?
> 
> Kind regards,
> Henri
> 

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to