[Dev-luatex] \lastnodetype not working as expected in LuaTeX
Frank Mittelbach
frank.mittelbach at latex-project.org
Tue Jun 12 22:45:23 CEST 2012
Hi Hans
> Here's the whole story:
>
> function oneliner(head)
> local h = node.hpack(head)
> local d = tex.baselineskip.width - tex.nest[tex.nest.ptr].prevdepth -
> h.height
> tex.nest[tex.nest.ptr].prevdepth = h.depth
> tex.nest[tex.nest.ptr].prevgraf = 1
> local n
> if d < tex.lineskiplimit then
> n = 1
> d = tex.lineskip
> else
> n = 2
> end
> local s = node.new("glue_spec")
> local n = node.new("glue",n)
> s.width = d
> n.spec = s
> return node.insert_before(h,h,n)
> end
>
> -- the function also has to take care of adding proper skips
> -- before (and if needed after) and setting some parameters
>
> callback.register("linebreak_filter",oneliner)
I agree that this is what you need to do to get baselineskip etc being
set. For my application it is not really necessary since I just want to
get the paragrpah back as a single hline to be able to store it and thus
am not at all interested in any of thoss.
It makes sense to to set those parameters in any other situations (but
then you could also think about taking out the inserts and vadjusts etc).
However, I do not see you correcting the "tail" and if I understand it
correctly that is something that can'T be done in "linebreak_filter"
because the **wrong** setting is needed to find just_box the way the
code currently works.
So in my opinion the above is somehting that should be documented as
part of the filter (that such values should be set by the routine) but
the "tail" missing correction is in my opinion a bug and should be fixed
in the code.
So in my opinion the whole story (at the moment) also need to involve
function fix_nest_tail (head)
tex.nest[tex.nest.ptr].tail = node.tail(head)
return true
end
callback.register("post_linebreak_filter",fix_nest_tail)
cheers
frank
More information about the dev-luatex
mailing list