ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* wrong page for annotation and \pagenumber
@ 2020-06-15 12:52 Pablo Rodriguez
  2020-06-15 14:09 ` Wolfgang Schuster
  2020-06-16  2:53 ` Rudolf Bahr
  0 siblings, 2 replies; 8+ messages in thread
From: Pablo Rodriguez @ 2020-06-15 12:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

I have the following number with wrong annotation placement and wrong
page number, which would be both on the second page:

  \setupinteraction[state=start]
  \definelayer[pgnumber]
  \setupbackgrounds[page][background=pgnumber]
  \starttext
  \placelist[section][alternative=d]
  \dorecurse{16}{\section{Section}}
  \pagenumber/\lastpagenumber
  \setlayer[pgnumber]
    {\comment{\pagenumber}}
  \stoptext

Could anyone confirm the issue?

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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] 8+ messages in thread

* Re: wrong page for annotation and \pagenumber
  2020-06-15 12:52 wrong page for annotation and \pagenumber Pablo Rodriguez
@ 2020-06-15 14:09 ` Wolfgang Schuster
  2020-06-15 15:29   ` Pablo Rodriguez
  2020-06-16  2:53 ` Rudolf Bahr
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2020-06-15 14:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Pablo Rodriguez schrieb am 15.06.2020 um 14:52:
> Dear list,
> 
> I have the following number with wrong annotation placement and wrong
> page number, which would be both on the second page:
> 
>    \setupinteraction[state=start]
>    \definelayer[pgnumber]
>    \setupbackgrounds[page][background=pgnumber]
>    \starttext
>    \placelist[section][alternative=d]
>    \dorecurse{16}{\section{Section}}
>    \pagenumber/\lastpagenumber
>    \setlayer[pgnumber]
>      {\comment{\pagenumber}}
>    \stoptext
> 
> Could anyone confirm the issue?

\pagenumber is only reliable headers/footer texts or page backgrounds, 
for everything else you need a multi pass mechanism (save the page 
number in the first run and provide it in the second).

\setuppapersize[A6]

\definepagestate[pagenumber]

\starttext

\subject{\tex{pagenumber}}

\dorecurse{50}{\twodigits{\recurselevel}: \pagenumber\par}

\page

\subject{\tex{pagestaterealpage}}

\dorecurse{50}
   {\twodigits{\recurselevel}:
    \setpagestate[pagenumber]%
    \pagestaterealpage{pagenumber}{\recurselevel}\par}

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

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

* Re: wrong page for annotation and \pagenumber
  2020-06-15 14:09 ` Wolfgang Schuster
@ 2020-06-15 15:29   ` Pablo Rodriguez
  0 siblings, 0 replies; 8+ messages in thread
From: Pablo Rodriguez @ 2020-06-15 15:29 UTC (permalink / raw)
  To: ntg-context

On 6/15/20 4:09 PM, Wolfgang Schuster wrote:
> Pablo Rodriguez schrieb am 15.06.2020 um 14:52:
>> Dear list,
>>
>> I have the following number with wrong annotation placement and wrong
>> page number, which would be both on the second page:
>> [...]
>> Could anyone confirm the issue?
>
> \pagenumber is only reliable headers/footer texts or page backgrounds,
> for everything else you need a multi pass mechanism (save the page
> number in the first run and provide it in the second).

Many thanks for your reply, Wolfgang.

I thought this was caused by the deployment of
"\placelist[section][alternative=d]". But my new sample shows clearly
that this isn’t the cause.

My question is now is how to get the right page for the layer in this
sample:

  \definelayer[whatever]
    [x=3em, y=3em]
  \setupbackgrounds[page][background=whatever]
  \starttext
  \dorecurse{18}{\section{Section}}
  just a line
  \setlayerframed[whatever][foregroundstyle=\bf\ss]
    {layer on the last page?}
  \stoptext

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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] 8+ messages in thread

* Re: wrong page for annotation and \pagenumber
  2020-06-15 12:52 wrong page for annotation and \pagenumber Pablo Rodriguez
  2020-06-15 14:09 ` Wolfgang Schuster
@ 2020-06-16  2:53 ` Rudolf Bahr
  2020-06-16 14:31   ` Pablo Rodriguez
  1 sibling, 1 reply; 8+ messages in thread
From: Rudolf Bahr @ 2020-06-16  2:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

On Mon, Jun 15, 2020 at 02:52:49PM +0200, Pablo Rodriguez wrote:
> Dear list,
> 
> I have the following number with wrong annotation placement and wrong
> page number, which would be both on the second page:
> 
>   \setupinteraction[state=start]
>   \definelayer[pgnumber]
>   \setupbackgrounds[page][background=pgnumber]
>   \starttext
>   \placelist[section][alternative=d]
>   \dorecurse{16}{\section{Section}}
>   \pagenumber/\lastpagenumber
>   \setlayer[pgnumber]
>     {\comment{\pagenumber}}
>   \stoptext
> 
> Could anyone confirm the issue?
> 
> Many thanks for your help,
> 
> Pablo


Hi Pablo,

I fear I don't understand what issue you mean, therefore I append my output here.

I'm using:
LuaMetaTeX, Version 2.04.02
ConTeXt  ver: 2020.02.17 19:36 MKIV beta  fmt: 2020.2.23

Best wishes,
Rudolf

[-- Attachment #2: annotation-u-pagenumber.pdf --]
[-- Type: application/pdf, Size: 11025 bytes --]

[-- Attachment #3: 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] 8+ messages in thread

* Re: wrong page for annotation and \pagenumber
  2020-06-16  2:53 ` Rudolf Bahr
@ 2020-06-16 14:31   ` Pablo Rodriguez
  2020-06-16 14:58     ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Pablo Rodriguez @ 2020-06-16 14:31 UTC (permalink / raw)
  To: ntg-context

On 6/16/20 4:53 AM, Rudolf Bahr wrote:
> [...]
> Hi Pablo,
>
> I fear I don't understand what issue you mean, therefore I append my output here.

Many thanks for your reply, Rudolf.

The issue is that the layer is placed on the first page, where it should
be placed on the second page.

This sample shows thie problem in a simpler way:

  \definelayer[whatever]
    [x=3em, y=3em]
  \setupbackgrounds[page][background=whatever]
  \starttext
  \dorecurse{18}{\section{Section}}
  just a line
  \setlayerframed[whatever][foregroundstyle=\bf\ss]
    {layer on the last page?}
  \stoptext

I’m afraid that you get the same result, so there may be a bug there.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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] 8+ messages in thread

* Re: wrong page for annotation and \pagenumber
  2020-06-16 14:31   ` Pablo Rodriguez
@ 2020-06-16 14:58     ` Wolfgang Schuster
  2020-06-16 17:30       ` Pablo Rodriguez
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2020-06-16 14:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Pablo Rodriguez schrieb am 16.06.2020 um 16:31:
> On 6/16/20 4:53 AM, Rudolf Bahr wrote:
>> [...]
>> Hi Pablo,
>>
>> I fear I don't understand what issue you mean, therefore I append my output here.
> 
> Many thanks for your reply, Rudolf.
> 
> The issue is that the layer is placed on the first page, where it should
> be placed on the second page.
> 
> This sample shows thie problem in a simpler way:
> 
>    \definelayer[whatever]
>      [x=3em, y=3em]
>    \setupbackgrounds[page][background=whatever]

\setuphead
   [section]
   [before={\testpage[2]\blank[2*big]}]

>    \starttext
>    \dorecurse{18}{\section{Section}}
>    just a line
>    \setlayerframed[whatever][foregroundstyle=\bf\ss]
>      {layer on the last page?}
>    \stoptext
> 
> I’m afraid that you get the same result, so there may be a bug there.

There is no bug. When you take a look at my pagenumber example you see a 
few lines at the top show the number of the previous page, this happens 
because TeX collects more than necessary which means in your example 
above the layer is placed when TeX was still on the first page.

In your example you can add \testpage to \section to force a page break 
when there isn't enough space available to place the heading, this moves
also the layer placement to the next page.

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

* Re: wrong page for annotation and \pagenumber
  2020-06-16 14:58     ` Wolfgang Schuster
@ 2020-06-16 17:30       ` Pablo Rodriguez
  2020-06-16 17:46         ` Aditya Mahajan
  0 siblings, 1 reply; 8+ messages in thread
From: Pablo Rodriguez @ 2020-06-16 17:30 UTC (permalink / raw)
  To: ntg-context

On 6/16/20 4:58 PM, Wolfgang Schuster wrote:
> Pablo Rodriguez schrieb am 16.06.2020 um 16:31:
>> [...]
>> I’m afraid that you get the same result, so there may be a bug there.
>
> There is no bug. When you take a look at my pagenumber example you see a
> few lines at the top show the number of the previous page, this happens
> because TeX collects more than necessary which means in your example
> above the layer is placed when TeX was still on the first page.

Many thanks for your reply, Wolfgang.

I’m afraid that TeX is too tricky for me in that case (or I simply think
that it is misbehaving there).

> In your example you can add \testpage to \section to force a page break
> when there isn't enough space available to place the heading, this moves
> also the layer placement to the next page.

I’m afraid this doesn’t work with my real document.

I need another approach. This sample reflects my problem:

  \setupinteraction[state=start]
  %~ \showframe\showgrid
  \starttext
    \dorecurse{41}{one line\par}

    \ \comment[location={rightmargin}]{comment}
  \stoptext

Since layers are problematic for the task, I insert the comments right
after the text (which actually comes from \xmlflush{#1} [XML sources]).

I’m afraid that the paragraph before \comment comes from \xmlflush, so I
cannot avoid it.

This is unproblematic for most cases, but the sample above displays the
problem of adding a comment in a new paragraph. It might add a new page.

To avoid this issue: how could I prevent the pagebreak before \comment
and the addition of a pagebreak above?

If that were possible, I could add a \blank[-2*line] that would place
the comment right.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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] 8+ messages in thread

* Re: wrong page for annotation and \pagenumber
  2020-06-16 17:30       ` Pablo Rodriguez
@ 2020-06-16 17:46         ` Aditya Mahajan
  0 siblings, 0 replies; 8+ messages in thread
From: Aditya Mahajan @ 2020-06-16 17:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

On Tue, 16 Jun 2020, Pablo Rodriguez wrote:

> On 6/16/20 4:58 PM, Wolfgang Schuster wrote:
>> Pablo Rodriguez schrieb am 16.06.2020 um 16:31:
>>> [...]
>>> I’m afraid that you get the same result, so there may be a bug there.
>>
>> There is no bug. When you take a look at my pagenumber example you see a
>> few lines at the top show the number of the previous page, this happens
>> because TeX collects more than necessary which means in your example
>> above the layer is placed when TeX was still on the first page.
>
> Many thanks for your reply, Wolfgang.
>
> I’m afraid that TeX is too tricky for me in that case (or I simply think
> that it is misbehaving there).
>
>> In your example you can add \testpage to \section to force a page break
>> when there isn't enough space available to place the heading, this moves
>> also the layer placement to the next page.
>
> I’m afraid this doesn’t work with my real document.
>
> I need another approach. This sample reflects my problem:
>
>  \setupinteraction[state=start]
>  %~ \showframe\showgrid
>  \starttext
>    \dorecurse{41}{one line\par}
>
>    \ \comment[location={rightmargin}]{comment}
>  \stoptext
>
> Since layers are problematic for the task, I insert the comments right
> after the text (which actually comes from \xmlflush{#1} [XML sources]).
>
> I’m afraid that the paragraph before \comment comes from \xmlflush, so I
> cannot avoid it.
>
> This is unproblematic for most cases, but the sample above displays the
> problem of adding a comment in a new paragraph. It might add a new page.
>
> To avoid this issue: how could I prevent the pagebreak before \comment
> and the addition of a pagebreak above?
>
> If that were possible, I could add a \blank[-2*line] that would place
> the comment right.

Try

\removeunwantedwhitespace

or

\blank[samepage]

Aditya

[-- 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] 8+ messages in thread

end of thread, other threads:[~2020-06-16 17:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 12:52 wrong page for annotation and \pagenumber Pablo Rodriguez
2020-06-15 14:09 ` Wolfgang Schuster
2020-06-15 15:29   ` Pablo Rodriguez
2020-06-16  2:53 ` Rudolf Bahr
2020-06-16 14:31   ` Pablo Rodriguez
2020-06-16 14:58     ` Wolfgang Schuster
2020-06-16 17:30       ` Pablo Rodriguez
2020-06-16 17:46         ` Aditya Mahajan

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