ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Strange behaviour of TABLE with \currentTABLErow
@ 2018-12-03 19:23 Tomas Hala
  2018-12-03 22:14 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Tomas Hala @ 2018-12-03 19:23 UTC (permalink / raw)
  To: Mailing list ConTeXt

Hi all,

at https://wiki.contextgarden.net/Command/currentTABLEcolumn I learnt
about \currentTABLErow etc. for counting lines in natural tables.

I have got the following two minimal non-working examples (on TeXlive 2018):

\starttext\setupTABLE[split=yes]
  \bTABLE
  \bTABLEhead\bTR\bTH head      \eTH\eTR\eTABLEhead
  \bTABLEbody
    \dorecurse{100}{\bTR\bTD \currentTABLErow xxx \eTD\eTR}
  \eTABLEbody
  \eTABLE
\stoptext

In this case, the head-line is alse counted which makes no sense
and I do not know how to supress it.

If I add \bTABLEnext (below), I receive very strange result -- both heads
are at the beginning of the table and both counted. Moreover, the "next"
head is not used on the following pages.

\starttext\setupTABLE[split=yes]
  \bTABLE
  \bTABLEhead\bTR\bTH head      \eTH\eTR\eTABLEhead
  \bTABLEnext\bTR\bTH next head \eTH\eTR\eTABLEnext
  \bTABLEbody
    \dorecurse{100}{\bTR\bTD \currentTABLErow xxx \eTD\eTR}
  \eTABLEbody
  \eTABLE
\stoptext

I tried \TC and \TD instead of \TH, also without success. 
What I am doing wrong?  
Thanks in advance for help.

Best wishes,

Tomáš

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

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

* Re: Strange behaviour of TABLE with \currentTABLErow
  2018-12-03 19:23 Strange behaviour of TABLE with \currentTABLErow Tomas Hala
@ 2018-12-03 22:14 ` Wolfgang Schuster
  2018-12-10 11:15   ` Tomas Hala
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2018-12-03 22:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Tomas Hala

Tomas Hala schrieb am 03.12.18 um 20:23:
> Hi all,
>
> at https://wiki.contextgarden.net/Command/currentTABLEcolumn I learnt
> about \currentTABLErow etc. for counting lines in natural tables.
>
> I have got the following two minimal non-working examples (on TeXlive 2018):
>
> \starttext\setupTABLE[split=yes]
>    \bTABLE
>    \bTABLEhead\bTR\bTH head      \eTH\eTR\eTABLEhead
>    \bTABLEbody
>      \dorecurse{100}{\bTR\bTD \currentTABLErow xxx \eTD\eTR}
>    \eTABLEbody
>    \eTABLE
> \stoptext
>
> In this case, the head-line is alse counted which makes no sense
> and I do not know how to supress it.
Even though this is not what you expect it makes sense because when ConTeXt
creates the table the whole thing is only one huge part which the 
headers for
the first and the following pages on top and the footer on the bottom.

The number of rows is now determined by the number of all rows
(including header and footer) and the counting starts also from the first
row in the table independent of the type of the row.

What you want is a counter which removes the header row from the value
but to keep backwards compatibility this has to be a new command,
e.g. \currentTABLEbodyrow
> If I add \bTABLEnext (below), I receive very strange result -- both heads
> are at the beginning of the table and both counted. Moreover, the "next"
> head is not used on the following pages.
>
> \starttext\setupTABLE[split=yes]
>    \bTABLE
>    \bTABLEhead\bTR\bTH head      \eTH\eTR\eTABLEhead
>    \bTABLEnext\bTR\bTH next head \eTH\eTR\eTABLEnext
>    \bTABLEbody
>      \dorecurse{100}{\bTR\bTD \currentTABLErow xxx \eTD\eTR}
>    \eTABLEbody
>    \eTABLE
> \stoptext
>
> I tried \TC and \TD instead of \TH, also without success.
> What I am doing wrong?
You need split=repeat.

The normal command to create a cell is \bTD, the \bTH command
is usefull for the header because it changes the font style to bold
and it also disables the character alignment for the current cell.

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

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

* Re: Strange behaviour of TABLE with \currentTABLErow
  2018-12-03 22:14 ` Wolfgang Schuster
@ 2018-12-10 11:15   ` Tomas Hala
  0 siblings, 0 replies; 3+ messages in thread
From: Tomas Hala @ 2018-12-10 11:15 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users

Hi Wolfgang, 

thank you for your reply. 

The split=repeat -- my fault, sorry. But -- surprisingly -- this mistake
helped me along understanding the problem. I discovered -- if head
and next head are defined -- that the "line number 1" servers for the
opening head at the beginning of a table whereas "line number 2" 
is used for all "next heads" at all pages of the table. 

So the problem is reduced to substracting one or two for only heads
and head+next heads, respectively.

Best wishes,

Tomáš 

P. S.
One possible solution can be e.g.:

\newcount\myrow
\def\currentTABLEbodyrow{\def\takenumber##1{\myrow=##1\advance\myrow-2 \the\myrow}\takenumber\currentTABLErow}



The number of rows is now determined by the number of all rows
# (including header and footer) and the counting starts also from the first
# row in the table independent of the type of the row.



Mon, Dec 03, 2018 ve 11:14:53PM +0100 Wolfgang Schuster napsal(a):
# Tomas Hala schrieb am 03.12.18 um 20:23:
# >Hi all,
# >
# >at https://wiki.contextgarden.net/Command/currentTABLEcolumn I learnt
# >about \currentTABLErow etc. for counting lines in natural tables.
# >
# >I have got the following two minimal non-working examples (on TeXlive 2018):
# >
# >\starttext\setupTABLE[split=yes]
# >   \bTABLE
# >   \bTABLEhead\bTR\bTH head      \eTH\eTR\eTABLEhead
# >   \bTABLEbody
# >     \dorecurse{100}{\bTR\bTD \currentTABLErow xxx \eTD\eTR}
# >   \eTABLEbody
# >   \eTABLE
# >\stoptext
# >
# >In this case, the head-line is alse counted which makes no sense
# >and I do not know how to supress it.
# Even though this is not what you expect it makes sense because when ConTeXt
# creates the table the whole thing is only one huge part which the
# headers for
# the first and the following pages on top and the footer on the bottom.
# 
# The number of rows is now determined by the number of all rows
# (including header and footer) and the counting starts also from the first
# row in the table independent of the type of the row.
# 
# What you want is a counter which removes the header row from the value
# but to keep backwards compatibility this has to be a new command,
# e.g. \currentTABLEbodyrow
# >If I add \bTABLEnext (below), I receive very strange result -- both heads
# >are at the beginning of the table and both counted. Moreover, the "next"
# >head is not used on the following pages.
# >
# >\starttext\setupTABLE[split=yes]
# >   \bTABLE
# >   \bTABLEhead\bTR\bTH head      \eTH\eTR\eTABLEhead
# >   \bTABLEnext\bTR\bTH next head \eTH\eTR\eTABLEnext
# >   \bTABLEbody
# >     \dorecurse{100}{\bTR\bTD \currentTABLErow xxx \eTD\eTR}
# >   \eTABLEbody
# >   \eTABLE
# >\stoptext
# >
# >I tried \TC and \TD instead of \TH, also without success.
# >What I am doing wrong?
# You need split=repeat.
# 
# The normal command to create a cell is \bTD, the \bTH command
# is usefull for the header because it changes the font style to bold
# and it also disables the character alignment for the current cell.
# 
# Wolfgang

                                         Tomáš Hála
--------------------------------------------------------------------
Mendelova univerzita, Provozně ekonomická fakulta, ústav informatiky
Zemědělská 1, CZ-613 00 Brno,  tel. +420 545 13 22 28
--------------------------------------------------------------------
http://akela.mendelu.cz/~thala
___________________________________________________________________________________
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
___________________________________________________________________________________

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

end of thread, other threads:[~2018-12-10 11:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 19:23 Strange behaviour of TABLE with \currentTABLErow Tomas Hala
2018-12-03 22:14 ` Wolfgang Schuster
2018-12-10 11:15   ` Tomas Hala

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