ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* new page before xtable with repeated headers
@ 2021-04-23  9:33 Werner Hennrich
  2021-04-23 19:28 ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Werner Hennrich @ 2021-04-23  9:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hello everyone,

I'm having an xtable spanning several pages and need to have its headers
repeated.

For this I've set "split=repeat", but unfortunately this causes the
table to start with a new new page leaving the rest of the preceding
page empty. Having "split=yes" makes the tabe continue on the previous
page as a need it to, but then the header isn't repeated any longer.

I realize that there has been a very similar question already in
https://www.mail-archive.com/ntg-context@ntg.nl/msg93775.html, but my
problem happens isolated in a very clean situation w/o any header,
floats or the like - and I don't see yet how I can get this working in
my situation. Any help is highly appreciated, here is a MWE of my problem:

\definextable[mytable]
\setupxtable[mytable]
[
option=max,
split=repeat,
%split=yes,
header=repeat,
width=\textwidth
]
\definextable[mytable:header]
\setupxtable[mytable:header]
[
foregroundstyle=\bf,
foregroundcolor=darkred,
]
% ==================================================
\startdocument
\dorecurse{2} {
\input tufte
\vskip7mm
}
\startxtable[mytable]
\startxtablehead
\startxrow[mytable:header]
\startxcell Some Header \stopxcell
\startxcell More Header \stopxcell
\stopxrow
\stopxtablehead
\startxtablebody
\dorecurse{10} {
\startxrow
\startxcell
{\bf (\recurselevel) some tale:}
\startitemize
\item a quick
\item brown fox
\item jumps over
\item the lazy dog
\stopitemize
\stopxcell
\startxcell
{\bf and a fact:}
\startitemize
\item the vodka
\item is good
\item but the meat
\item is rotten
\stopitemize
\stopxcell
\stopxrow
}
\stopxtablebody
\stopxtable
\stopdocument
Thank you very much i.a., Werner

[-- Attachment #1.2: Type: text/html, Size: 5186 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: new page before xtable with repeated headers
  2021-04-23  9:33 new page before xtable with repeated headers Werner Hennrich
@ 2021-04-23 19:28 ` Hans Hagen
  2021-04-24  7:56   ` Werner Hennrich
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Hans Hagen @ 2021-04-23 19:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Werner Hennrich, Wolfgang Schuster

On 4/23/2021 11:33 AM, Werner Hennrich wrote:
> Hello everyone,
> 
> I'm having an xtable spanning several pages and need to have its headers 
> repeated.
> 
> For this I've set "split=repeat", but unfortunately this causes the 
> table to start with a new new page leaving the rest of the preceding 
> page empty. Having "split=yes" makes the tabe continue on the previous 
> page as a need it to, but then the header isn't repeated any longer.
> 
> I realize that there has been a very similar question already in 
> https://www.mail-archive.com/ntg-context@ntg.nl/msg93775.html, but my 
> problem happens isolated in a very clean situation w/o any header, 
> floats or the like - and I don't see yet how I can get this working in 
> my situation. Any help is highly appreciated, here is a MWE of my problem:
Always tricky this (on my agenda is to look into the engines page 
builder ...)

You can put this on cont-new.mkxl as test:

\unprotect

\defcsname\??xtableflushsplit\v!repeat\endcsname
   {\doloop
      {\clf_x_table_flush
         method {\v!split}%
         height 
\ifdim\pagegoal=\maxdimen\textheight\else\dimexpr\pagegoal-\pagetotal\relax\fi
       \relax
       \ifcase\c_tabl_x_state
         \exitloop
       \else
         \page
       \fi}}

\protect

Please test a lot! I also needs Wolfgangs opinion on this. Maybe 
preceding whitespace can interfere so maybe we need some 'slack' parameter.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: new page before xtable with repeated headers
  2021-04-23 19:28 ` Hans Hagen
@ 2021-04-24  7:56   ` Werner Hennrich
       [not found]   ` <97b89634-8d32-db43-ec9f-2fca501b9464@gmail.com>
  2021-05-31  8:50   ` Werner Hennrich
  2 siblings, 0 replies; 9+ messages in thread
From: Werner Hennrich @ 2021-04-24  7:56 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users, Wolfgang Schuster

Thank you Hans,

this works well in my unchanged MWE -
I'll do some more rigorous testing on monday and let you know.

Thanks a lot and hava a nice weekend!
Werner


Am 23.04.21 um 21:28 schrieb Hans Hagen:
> Always tricky this (on my agenda is to look into the engines page
> builder ...)
>
> You can put this on cont-new.mkxl as test:
>
> \unprotect
>
> \defcsname\??xtableflushsplit\v!repeat\endcsname
>  {\doloop
>     {\clf_x_table_flush
>        method {\v!split}%
>        height
> \ifdim\pagegoal=\maxdimen\textheight\else\dimexpr\pagegoal-\pagetotal\relax\fi
>      \relax
>      \ifcase\c_tabl_x_state
>        \exitloop
>      \else
>        \page
>      \fi}}
>
> \protect
>
> Please test a lot! I also needs Wolfgangs opinion on this. Maybe
> preceding whitespace can interfere so maybe we need some 'slack'
> parameter.
>
> Hans


___________________________________________________________________________________
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] 9+ messages in thread

* Re: new page before xtable with repeated headers
       [not found]   ` <97b89634-8d32-db43-ec9f-2fca501b9464@gmail.com>
@ 2021-04-26 13:36     ` Werner Hennrich
  0 siblings, 0 replies; 9+ messages in thread
From: Werner Hennrich @ 2021-04-26 13:36 UTC (permalink / raw)
  To: Wolfgang Schuster, Hans Hagen
  Cc: mailing list for ConTeXt users, Wolfgang Schuster

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

Am 25.04.21 um 10:52 schrieb Wolfgang Schuster:
> Yes, some slack is needed to avoid the table being pushed to the next
> space because not enough space is available. I recommend also to
> ensure a minimum amount of space (e.g. 5 lines) is available to avoid
> tables with just a few rows.
>
> Wolfgang

I caught a some fail-cases (attached) using a test-runner
(linux/bash/python3, attached as well) - hope this helps.

Thanks in advance und best regards,
Werner


[-- Attachment #2: xtables-failcases-tex.zip --]
[-- Type: application/zip, Size: 8462 bytes --]

[-- Attachment #3: xtables-py3-testrunner.zip --]
[-- Type: application/zip, Size: 3656 bytes --]

[-- Attachment #4: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: new page before xtable with repeated headers
  2021-04-23 19:28 ` Hans Hagen
  2021-04-24  7:56   ` Werner Hennrich
       [not found]   ` <97b89634-8d32-db43-ec9f-2fca501b9464@gmail.com>
@ 2021-05-31  8:50   ` Werner Hennrich
  2021-05-31  9:33     ` Hans Hagen
  2 siblings, 1 reply; 9+ messages in thread
From: Werner Hennrich @ 2021-05-31  8:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

I still rely in all my installations on this bit at the bottom to be in
cont-new.mkxl.
Is there a way to make this patch update-safe?

There are comments
in ./tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl:

    %D This file is loaded at runtime, thereby providing an excellent
    place for hacks,
    %D patches, extensions and new features. There can be local
    overloads in cont-loc
    %D (which has always been the case) and experimental code in
    cont-exp (which is also
    %D so old that I need to remind myself to check it occasionally, so
    here is the
    %D reminder).

I tried the mentioned local overload methods but didn't get them to work.
Did I mess up somehow or is the comment above outdated?
Are there any better ways - update-safe though?

Thanks a lot, Werner


Am 23.04.21 um 21:28 schrieb Hans Hagen:
> You can put this on cont-new.mkxl as test:
>
> \unprotect
>
> \defcsname\??xtableflushsplit\v!repeat\endcsname
>   {\doloop
>      {\clf_x_table_flush
>         method {\v!split}%
>         height
> \ifdim\pagegoal=\maxdimen\textheight\else\dimexpr\pagegoal-\pagetotal\relax\fi
>       \relax
>       \ifcase\c_tabl_x_state
>         \exitloop
>       \else
>         \page
>       \fi}}
>
> \protect



[-- Attachment #1.2: Type: text/html, Size: 2618 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: new page before xtable with repeated headers
  2021-05-31  8:50   ` Werner Hennrich
@ 2021-05-31  9:33     ` Hans Hagen
  2021-05-31 10:36       ` Werner Hennrich
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2021-05-31  9:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Werner Hennrich

On 5/31/2021 10:50 AM, Werner Hennrich wrote:
> I still rely in all my installations on this bit at the bottom to be in 
> cont-new.mkxl.
> Is there a way to make this patch update-safe?
> 
> There are comments 
> in ./tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl:
> 
>     %D This file is loaded at runtime, thereby providing an excellent
>     place for hacks,
>     %D patches, extensions and new features. There can be local
>     overloads in cont-loc
>     %D (which has always been the case) and experimental code in
>     cont-exp (which is also
>     %D so old that I need to remind myself to check it occasionally, so
>     here is the
>     %D reminder).
> 
> I tried the mentioned local overload methods but didn't get them to work.
> Did I mess up somehow or is the comment above outdated?
> Are there any better ways - update-safe though?
> 
> Thanks a lot, Werner
> 
> 
> Am 23.04.21 um 21:28 schrieb Hans Hagen:
>> You can put this on cont-new.mkxl as test:
>>
>> \unprotect
>>
>> \defcsname\??xtableflushsplit\v!repeat\endcsname
>>   {\doloop
>>      {\clf_x_table_flush
>>         method {\v!split}%
>>         height 
>> \ifdim\pagegoal=\maxdimen\textheight\else\dimexpr\pagegoal-\pagetotal\relax\fi
>>       \relax
>>       \ifcase\c_tabl_x_state
>>         \exitloop
>>       \else
>>         \page
>>       \fi}}
>>
>> \protect 
cont-new will be overwritten so when you put a patch in there you need 
to check a next upload if that patch is permanent

you can also put patched in a cont-loc file (make sure that you run 
mtxrun --generate after making one) and out that file in your 
texmf-local tree  (or project tree) as these will not be replaced

you can wrap such a patch in:

\ifcsname\??xtableflushsplit\v!repeat\endcsname \else

\fi

to make sure that it's not overloading something built in

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: new page before xtable with repeated headers
  2021-05-31  9:33     ` Hans Hagen
@ 2021-05-31 10:36       ` Werner Hennrich
  2021-05-31 10:45         ` Werner Hennrich
  2021-05-31 12:07         ` Hans Hagen
  0 siblings, 2 replies; 9+ messages in thread
From: Werner Hennrich @ 2021-05-31 10:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hello Hans,
loading from cont-loc now works, thank you!

Am 31.05.21 um 11:33 schrieb Hans Hagen:
> you can wrap such a patch in:
>
> \ifcsname\??xtableflushsplit\v!repeat\endcsname \else
>
> \fi
>
> to make sure that it's not overloading something built in

if I do this, I get:

    suggestion      > use \withcaron instead of \v

and if I use \withcaron, then the wrapper seems to be OK,
but the patch isn't loaded any more.
Wasn't the patch meant to override an already existing\xtableflushsplit
in this case?

Thank you,
Werner


[-- Attachment #1.2: Type: text/html, Size: 1306 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: new page before xtable with repeated headers
  2021-05-31 10:36       ` Werner Hennrich
@ 2021-05-31 10:45         ` Werner Hennrich
  2021-05-31 12:07         ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Werner Hennrich @ 2021-05-31 10:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

sorry, not true:

Am 31.05.21 um 12:36 schrieb Werner Hennrich:
> but the patch isn't loaded any more.

my

\writestatus\m!system{beware: LOCAL PATCH LOADED FOR xtable}

from inside the \else to \fi is indeed still in my console.

case re safe update closed -
thanks, Werner





[-- Attachment #1.2: Type: text/html, Size: 1115 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: new page before xtable with repeated headers
  2021-05-31 10:36       ` Werner Hennrich
  2021-05-31 10:45         ` Werner Hennrich
@ 2021-05-31 12:07         ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2021-05-31 12:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Werner Hennrich

On 5/31/2021 12:36 PM, Werner Hennrich wrote:
> Hello Hans,
> loading from cont-loc now works, thank you!
> 
> Am 31.05.21 um 11:33 schrieb Hans Hagen:
>> you can wrap such a patch in:
>>
>> \ifcsname\??xtableflushsplit\v!repeat\endcsname \else
>>
>> \fi
>>
>> to make sure that it's not overloading something built in
> 
> if I do this, I get:
> 
>     suggestion      > use \withcaron instead of \v
> 
> and if I use \withcaron, then the wrapper seems to be OK,
> but the patch isn't loaded any more.
> Wasn't the patch meant to override an already existing\xtableflushsplit 
> in this case?
you rforgot the \unprotect .. \protect around that code, so tex sees

   \v!foo -> \v !foo

instead of

   \v!foo

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2021-05-31 12:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23  9:33 new page before xtable with repeated headers Werner Hennrich
2021-04-23 19:28 ` Hans Hagen
2021-04-24  7:56   ` Werner Hennrich
     [not found]   ` <97b89634-8d32-db43-ec9f-2fca501b9464@gmail.com>
2021-04-26 13:36     ` Werner Hennrich
2021-05-31  8:50   ` Werner Hennrich
2021-05-31  9:33     ` Hans Hagen
2021-05-31 10:36       ` Werner Hennrich
2021-05-31 10:45         ` Werner Hennrich
2021-05-31 12:07         ` 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).