* \everyaftershipout isn't "called" for every pagebreak
@ 2010-01-16 16:53 Andreas Schneider
2010-01-16 20:00 ` Wolfgang Schuster
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Schneider @ 2010-01-16 16:53 UTC (permalink / raw)
To: ntg-context
Hi,
I'm using \appendtoks...\to\everyaftershipout to reset a variable on every
pagebreak. This doesn't work as I expect(ed) it, since it seems to only
trigger after a paragraph. The following example shows the problem. On every
new page, the first footnote should be "New", which is not the case here.
What would be the way to go for me, to get the result I described?
Thanks in advance,
Andreas.
The example:
\define\test{\doifelse{\getvalue{testvar}}{page}{%
\footnote{Repeat}%
}{%
\footnote{New}%
\setvalue{testvar}{page}%
}}
\appendtoks
\global\setvalue{testvar}{}
\to\everyaftershipout
\starttext
\dorecurse{10}{\dorecurse{250}{text }\test}
\dorecurse{10}{\dorecurse{250}{text }\test}
\stoptext
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: \everyaftershipout isn't "called" for every pagebreak
2010-01-16 16:53 \everyaftershipout isn't "called" for every pagebreak Andreas Schneider
@ 2010-01-16 20:00 ` Wolfgang Schuster
2010-01-16 21:58 ` Andreas Schneider
0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2010-01-16 20:00 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 16.01.2010 um 17:53 schrieb Andreas Schneider:
> Hi,
>
> I'm using \appendtoks...\to\everyaftershipout to reset a variable on every
> pagebreak. This doesn't work as I expect(ed) it, since it seems to only
> trigger after a paragraph. The following example shows the problem. On every
> new page, the first footnote should be "New", which is not the case here.
> What would be the way to go for me, to get the result I described?
This can't work because TeX collects mote material than it needs for the current
page and the same happens with the footnotes, the only thing you can do is to
use two pass data
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: \everyaftershipout isn't "called" for every pagebreak
2010-01-16 20:00 ` Wolfgang Schuster
@ 2010-01-16 21:58 ` Andreas Schneider
2010-01-17 20:42 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Schneider @ 2010-01-16 21:58 UTC (permalink / raw)
To: ntg-context
Wolfgang Schuster wrote:
>
> This can't work because TeX collects mote material than it needs for the
> current page and the same happens with the footnotes, the only thing you
> can do is to use two pass data
>
> Wolfgang
Is there not even some event in Lua that could be used to handle this case?
I think MkIV compatibility is all I need.
In case this is also not possible: can you give me a hint where to learn
more about twopass processing? Is there in MkIV still something that
requires two (or more) passes that I could take a look at to learn how to do
it? (I guess I can understand Lua easier than plain TeX, so I guess MkII is
out of the picture.)
Thanks for your fast answer!
Best regards,
Andreas.
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: \everyaftershipout isn't "called" for every pagebreak
2010-01-16 21:58 ` Andreas Schneider
@ 2010-01-17 20:42 ` Hans Hagen
2010-01-17 21:16 ` Andreas Schneider
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2010-01-17 20:42 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Andreas Schneider
On 16-1-2010 22:58, Andreas Schneider wrote:
> Wolfgang Schuster wrote:
>>
>> This can't work because TeX collects mote material than it needs for the
>> current page and the same happens with the footnotes, the only thing you
>> can do is to use two pass data
>>
>> Wolfgang
>
> Is there not even some event in Lua that could be used to handle this case?
> I think MkIV compatibility is all I need.
> In case this is also not possible: can you give me a hint where to learn
> more about twopass processing? Is there in MkIV still something that
> requires two (or more) passes that I could take a look at to learn how to do
> it? (I guess I can understand Lua easier than plain TeX, so I guess MkII is
> out of the picture.)
It depends on your document. We have workflows where we can do with one
pass in which case we run with --once (--runs=2 or so)
Future versions of context mkiv might need one run less (in some cases)
or one perceived run (which saves startup cycles) but as Wolgangs
explained already, in more complex cases we cannot do with less runs as
any change haping now can influence something a few pages back which in
turn might influence what follows.
Normally, when you correct only typos there will be no multiple runs.
MkIV already is more efficient as we now always assume an advanced pdf
backend so that we don't need to use the MkII the object reference
mechanism.
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: \everyaftershipout isn't "called" for every pagebreak
2010-01-17 20:42 ` Hans Hagen
@ 2010-01-17 21:16 ` Andreas Schneider
2010-01-17 21:45 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Schneider @ 2010-01-17 21:16 UTC (permalink / raw)
To: ntg-context
Hans Hagen wrote:
> It depends on your document. We have workflows where we can do with one
> pass in which case we run with --once (--runs=2 or so)
>
> Future versions of context mkiv might need one run less (in some cases)
> or one perceived run (which saves startup cycles) but as Wolgangs
> explained already, in more complex cases we cannot do with less runs as
> any change haping now can influence something a few pages back which in
> turn might influence what follows.
>
> Normally, when you correct only typos there will be no multiple runs.
>
> MkIV already is more efficient as we now always assume an advanced pdf
> backend so that we don't need to use the MkII the object reference
> mechanism.
>
> Hans
In my example I can't even get \pagenumber to work correctly. If I replace
my \test macro with \pagenumber, the first 4 pages all print page "1" (since
it's still the same paragraph). Is there anything I can do about that? (Of
course my main concern is the original problem of not catching page breaks
to reset a variable).
I also can't quite work out a multi-pass solution ... the only way I could
imagine how it could work is by storing the content I would like to print
together with the coordinates it was printed to in the first run, and in the
second run evaluate from these information when a page break occured and
modify the data accordingly. But I'm a bit lost here where to start ... my
TeX knowledge is rather basic and I don't know anything about the luatex
internals so I don't know if there are any events I could hook (and when and
where to hook them :-/).
I would be very grateful if you could point me in a direction I can work
forward from - I can only guess that there are similar mechanisms in the
already existing MkIV code ... although the \pagenumber problem seems to
indicate that it might be near to impossible :-/
Best Regards,
Andreas.
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: \everyaftershipout isn't "called" for every pagebreak
2010-01-17 21:16 ` Andreas Schneider
@ 2010-01-17 21:45 ` Hans Hagen
2010-01-17 22:13 ` Andreas Schneider
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2010-01-17 21:45 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Andreas Schneider
On 17-1-2010 22:16, Andreas Schneider wrote:
> I would be very grateful if you could point me in a direction I can work
> forward from - I can only guess that there are similar mechanisms in the
> already existing MkIV code ... although the \pagenumber problem seems to
> indicate that it might be near to impossible :-/
dealing with multipass data in mkiv is completely different from mkii
and at some point there will be a proper api for users (makes no sense
now as i might as well change internals along with luatex developments)
in mkiv we store info in tables and much is available during a document
run anyway (in mkii we filter data from the tuo file) so the question
is, what info do you need? it's probably easier to provide it as core
functionality
so i need speccs and a small test file
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: \everyaftershipout isn't "called" for every pagebreak
2010-01-17 21:45 ` Hans Hagen
@ 2010-01-17 22:13 ` Andreas Schneider
2010-01-17 22:25 ` Martin Schröder
2010-01-17 22:59 ` Hans Hagen
0 siblings, 2 replies; 10+ messages in thread
From: Andreas Schneider @ 2010-01-17 22:13 UTC (permalink / raw)
To: ntg-context
> dealing with multipass data in mkiv is completely different from mkii
> and at some point there will be a proper api for users (makes no sense
> now as i might as well change internals along with luatex developments)
>
> in mkiv we store info in tables and much is available during a document
> run anyway (in mkii we filter data from the tuo file) so the question
> is, what info do you need? it's probably easier to provide it as core
> functionality
>
> so i need speccs and a small test file
>
> Hans
Thanks for that info!
I think for specs my "plan" is too vague. I will explain what my goal is
then you either see a good solution and/or tell me that this is out of scope
for now :-)
The test file to demonstrate the problem is in my initial newsgroup post for
this thread. I will re-attach it here.
What I need would be a precise page break handling. Currently ConTeXt seems
to process a whole paragraph as one object, and then breaks it down to
individual pages. That leads to a problem however:
I want to refine my citation style. All bibliography is inserted into
footnotes. If two (or more) consecutive citations _on the same page_ refer
to the same bib entry, the footnote for that citation should read "Ibidem".
Therefore I have to remember the last cited entry. Currently I use
\appendtoks...\to\everyaftershipout to reset/clear the variable I use for
storing that last entry. That works fine as long as the paragraphs are
small. If however several citations within one (possibly large) paragraph
are separated by a page break, the output will be wrong, since the event to
reset the variable occurs too late (see above).
The problem can be demonstrated with this example - the first footnote on
each page should be "New".
\define\test{\doifelse{\getvalue{testvar}}{page}{%
\footnote{Repeat}%
}{%
\footnote{New}%
\setvalue{testvar}{page}%
}}
\appendtoks
\global\setvalue{testvar}{}
\to\everyaftershipout
\starttext
\dorecurse{10}{\dorecurse{250}{text }\test}
\dorecurse{10}{\dorecurse{250}{text }\test}
\stoptext
Best Regards,
Andreas.
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: \everyaftershipout isn't "called" for every pagebreak
2010-01-17 22:13 ` Andreas Schneider
@ 2010-01-17 22:25 ` Martin Schröder
2010-01-17 22:59 ` Hans Hagen
1 sibling, 0 replies; 10+ messages in thread
From: Martin Schröder @ 2010-01-17 22:25 UTC (permalink / raw)
To: mailing list for ConTeXt users
2010/1/17 Andreas Schneider <aksdb@gmx.de>:
> What I need would be a precise page break handling. Currently ConTeXt seems
> to process a whole paragraph as one object, and then breaks it down to
> individual pages. That leads to a problem however:
This is how TeX works. :-)
Best
Martin
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: \everyaftershipout isn't "called" for every pagebreak
2010-01-17 22:13 ` Andreas Schneider
2010-01-17 22:25 ` Martin Schröder
@ 2010-01-17 22:59 ` Hans Hagen
2010-01-18 12:12 ` Andreas Schneider
1 sibling, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2010-01-17 22:59 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Andreas Schneider
On 17-1-2010 23:13, Andreas Schneider wrote:
>> dealing with multipass data in mkiv is completely different from mkii
>> and at some point there will be a proper api for users (makes no sense
>> now as i might as well change internals along with luatex developments)
>>
>> in mkiv we store info in tables and much is available during a document
>> run anyway (in mkii we filter data from the tuo file) so the question
>> is, what info do you need? it's probably easier to provide it as core
>> functionality
>>
>> so i need speccs and a small test file
>>
>> Hans
>
> Thanks for that info!
> I think for specs my "plan" is too vague. I will explain what my goal is
> then you either see a good solution and/or tell me that this is out of scope
> for now :-)
>
> The test file to demonstrate the problem is in my initial newsgroup post for
> this thread. I will re-attach it here.
>
> What I need would be a precise page break handling. Currently ConTeXt seems
> to process a whole paragraph as one object, and then breaks it down to
> individual pages. That leads to a problem however:
> I want to refine my citation style. All bibliography is inserted into
> footnotes. If two (or more) consecutive citations _on the same page_ refer
> to the same bib entry, the footnote for that citation should read "Ibidem".
> Therefore I have to remember the last cited entry. Currently I use
> \appendtoks...\to\everyaftershipout to reset/clear the variable I use for
> storing that last entry. That works fine as long as the paragraphs are
> small. If however several citations within one (possibly large) paragraph
> are separated by a page break, the output will be wrong, since the event to
> reset the variable occurs too late (see above).
>
> The problem can be demonstrated with this example - the first footnote on
> each page should be "New".
>
> \define\test{\doifelse{\getvalue{testvar}}{page}{%
> \footnote{Repeat}%
> }{%
> \footnote{New}%
> \setvalue{testvar}{page}%
> }}
>
> \appendtoks
> \global\setvalue{testvar}{}
> \to\everyaftershipout
>
> \starttext
> \dorecurse{10}{\dorecurse{250}{text }\test}
>
> \dorecurse{10}{\dorecurse{250}{text }\test}
> \stoptext
as it takes less time wrting a helper than explaining how to do it i
just added it as feature (a few years from probably only wolfgang
remembers that it's there)
i'll upload a beta to the website that provides ...
\starttext
\dorecurse {100} {
test \footnote{\doifnoteonsamepageelse[footnote]{ibidem}{aaa}}
}
\stoptext
keep in mind that such features, depending on multiple passes, might
result in a few more as it will never get things right the first time
actually, in some cases it might make sense to delete the tuc file
before a run
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: \everyaftershipout isn't "called" for every pagebreak
2010-01-17 22:59 ` Hans Hagen
@ 2010-01-18 12:12 ` Andreas Schneider
0 siblings, 0 replies; 10+ messages in thread
From: Andreas Schneider @ 2010-01-18 12:12 UTC (permalink / raw)
To: ntg-context
Hans Hagen wrote:
> as it takes less time wrting a helper than explaining how to do it i
> just added it as feature (a few years from probably only wolfgang
> remembers that it's there)
>
> i'll upload a beta to the website that provides ...
>
> \starttext
>
> \dorecurse {100} {
> test \footnote{\doifnoteonsamepageelse[footnote]{ibidem}{aaa}}
> }
>
> \stoptext
>
> keep in mind that such features, depending on multiple passes, might
> result in a few more as it will never get things right the first time
>
> actually, in some cases it might make sense to delete the tuc file
> before a run
>
> Hans
Thank you very much for all that effort! It works very well and as a side-
effect also gives me a nice point to start learning more about the (lua)tex
internals. Seems like I will have to go to one of the next ConTeXt user
meetings so I can repay you with the beer(s) I now owe you :-)
Just in case someone else needs it: I used the following code now to reset
my variable whenever a footnote is placed on a new page. That was necessary
so a manually set footnote doesn't interfere with my citation-footnotes.
(Otherwise, if a manually inserted footnote would be the first on a page,
the next citation footnote would evaluate as "being on the same page as the
last one".)
\appendtoks
\doifnoteonsamepageelse[footnote]{}{\global\setvalue{mycitelast}{}}
\to\everyinsidenoteinsert
Best Regards (and many thanks again!)
Andreas.
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-01-18 12:12 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-16 16:53 \everyaftershipout isn't "called" for every pagebreak Andreas Schneider
2010-01-16 20:00 ` Wolfgang Schuster
2010-01-16 21:58 ` Andreas Schneider
2010-01-17 20:42 ` Hans Hagen
2010-01-17 21:16 ` Andreas Schneider
2010-01-17 21:45 ` Hans Hagen
2010-01-17 22:13 ` Andreas Schneider
2010-01-17 22:25 ` Martin Schröder
2010-01-17 22:59 ` Hans Hagen
2010-01-18 12:12 ` Andreas Schneider
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).