I see. So is it reliable to simply use lua function tex.getcount(‘realpageno’) in vertical mode to determine that page has changed ? Or do I need some other mechanism please ? If page has changed I agree that there is no need to deal with hangindent. I use grid typesetting so normally all lines have same height ? De : Hans Hagen Envoyé le :lundi 5 mars 2018 16:06 À : ntg-context@ntg.nl Objet :Re: [NTG-context] prevgraf change if page break occurs in a paragraph On 3/5/2018 3:51 PM, Joseph Canedo wrote:
If I have a callback called just after paragraph has been split into lines, would not be enough to count the number of hboxes in the vbox the paragraph itself is contained ? Cannot say it’s ideal (easier to simply read tex.prevgraf for sure), but might be possible, unless I missed something (totally possible).
In a couple of cases I see \prevgraf being larger than number of lines of previous paragraph, including lines for paragraph before than one as well. Could not create a MWE unfortunately to reproduce this case so far.
I’ll try to amend my dropcaps/lettrine logic then. What are the reasons behind this change in \prevgraf TeX primitive which AFAIK exists since TeX has been written ? I thought that one of the strong points in TeX was overall stability of its behaviour among versions. Here with this semantic change in \prevgraf in recent luatex, this stability is a bit broken IMO.
it's *not changed* in luatex .. context *itself* sets the prevgraf at the next page as indicator of the left-over lines say that you have: XXX ------------------ XXX ------------------ ---------------------- ---------------------- - a page break between the first and second line is a bug in your code - a page break after the second line is harmless and as we're on a new page then there is nothing to be done i.e. prevgraf then is set to 2 (as we have two lines if we look back) say that you have: XXX ------------------ XXX - if you get a page break here, again there is nothing to be done as you're on a next page - if you need to pick up in the next pagagraph (on the same page) then prevgraf is 1 so, what in your case does it mean that when your next paragraph is on the next page you look at prevgraf? there is no need to hangindent as your hanging stuff is on the previous page also, in general prevgraf is kind of useless when you have lines higher than lineheight so if you use a callback, you also should calculate the real accumulated drop so far
Joseph
*De : *Hans Hagen mailto:pragma@wxs.nl *Envoyé le :*lundi 5 mars 2018 10:15 *À : *ntg-context@ntg.nl mailto:ntg-context@ntg.nl *Objet :*Re: [NTG-context] prevgraf change if page break occurs in a paragraph
On 3/5/2018 9:43 AM, Joseph Canedo wrote:
I see. I use prevgraf to get number of lines in most recent paragraph to
compute eventually hangindent if there is a lettrine in paragraph (in
case first paragraph has fewer lines than the lettrine itself, of course
next paragraph needs to setup hangindent properly).
but .. that one is then still on the same page; in fact, you should
check for realpage being changed then
I guess as an alternative, I could use the callback after paragraph is
split in N lines to count the number of lines, or is this number can be
accessed via some other existing variable in tex lua « table » ?
Currently I access prevgraf value Inside lua. Probably better than
making things more complicated in luatex itself.
prevgraf is still ok after a 7 line paragraph but ... when you cross a
page, and have say 4 lines moved to the next one, then a 7 line
hangafter would be wrong (you can check if a par is on the same page)
with callbacks after breaking in lines you still don't know ...
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
___________________________________________________________________________________
___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- ----------------------------------------------------------------- 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 ___________________________________________________________________________________