View Issue Details

IDProjectCategoryView StatusLast Update
0000589luatexluatex bugpublic2015-11-11 13:48
ReporterTaco Assigned ToHans Hagen  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Fixed in Version0.85.0 
Summary0000589: Various prevdepth / prevgraph lua interface things
DescriptionFrom Paul:

See the attached file for what I've found experimenting with nodes. The \prevdepth problem looks pretty serious to me (well, at least it prevents me from having unlimited fun with linebreak_filter and tex.linebreak).


Steps To ReproduceSee items 0-3 in the attached file
TagsNo tags attached.



2011-02-28 10:10


buglets.tex (2,661 bytes)   
% Bugs:
% 0-3: \prevdepth/\prevgraf problems.
% 4-5: node fields problems.
% Bug #3 seems to be the crux of the biscuit, but I'm no good judge.

% Choose your bug:

\ifcase\bug % 0
% tex.prevdepth is supposed to be read-only, according to the manual. Yet:
% (Also with prevgraf.)
  tex.prevdepth = 100

\or % 1
% Improper prevdepth? Disappears if the following line is uncommented.
%\directlua{tex.prevdepth = 0}

\or % 2
% (This might be just a side-effect/particular case of the following problem.)
% Disconnection between tex.prevdepth and \prevdepth.  (Also with prevgraf.)
% Less clear to me, though, I might have misunderstood something.
% write_nl prints -65536000 as expected for the first paragraph.  For the
% second, however, it prints 0, i.e. the \prevdepth declaration isn't taken
% into account. Now it is taken into account if you remove the line:
% tex.prevdepth = info.prevdepth
% But then prevdepth isn't automatically updated; so I guess setting
% tex.prevdepth to info.prevdepth is required when breaking paragraph by hand
% (unless, well, see next bug).

function (head)
  local par, info = tex.linebreak(head)
  tex.prevdepth = info.prevdepth
  return par

abc\par \prevdepth=-10000pt abc

\or % 3
% The paragraph's first node is an hlist for the first two paragraphs, and a
% glue for the third (and any following paragraphs). In other words, it is as
% if tex.linebreak takes prevdepth into account if and only if it has already
% been set with \prevdepth (not tex.prevdepth).
function (head)
  local par = tex.linebreak(head)
  return par

%\directlua{tex.prevdepth = 0} % Doesn't work the Lua way.

\or % 4
% Prints "subtype" among others, although temp nodes have no subtype (also
% with action items 49, and probably other); also, prints "next" (for 50) and
% "next" and "prev" (for others), which is probably on purpose, although it
% might lead to error when investigating an isolated node.
for _, f in pairs(node.fields(0)) do

% Correlatively, validates an unexisting field:
local n =
if node.has_field(n, "subtype") then
  texio.write_nl("Something's wrong.")

\or % 5
% And a crash (only with 50, as far as I can tell):
local n =
local x = node.has_field(n, "foo")


buglets.tex (2,661 bytes)   

Hans Hagen

2015-11-11 13:48

manager   ~0001540

prevdepth, prevgraf and spacefactor are now intercepted; before doing tex.prevdepth just created a new entry (as it was not settable) so the observed behaviour was actually as expected; so, the new interception is just a convenience equivalent to operating on the tex.nest top entry (which is actually where one should mess)

Issue History

Date Modified Username Field Change
2011-02-28 10:10 Taco New Issue
2011-02-28 10:10 Taco Status new => assigned
2011-02-28 10:10 Taco Assigned To => Taco
2011-02-28 10:10 Taco File Added: buglets.tex
2015-11-11 11:42 Hans Hagen Assigned To Taco => Hans Hagen
2015-11-11 13:48 Hans Hagen Note Added: 0001540
2015-11-11 13:48 Hans Hagen Status assigned => closed
2015-11-11 13:48 Hans Hagen Resolution open => fixed
2015-11-11 13:48 Hans Hagen Fixed in Version => 0.85.0