local dir_math_mod = luatexja.dir_table.dir_math_mod
local dir_node_auto = luatexja.dir_table.dir_node_auto
local dir_node_manual = luatexja.dir_table.dir_node_manual
+local function get_attr_icflag(p)
+ return (has_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG
+end
local page_direction
--
local function get_dir_count_inner(h)
if h then
if h.id==id_whatsit and h.subtype==sid_user and h.user_id==DIR then
- local ic = node.has_attribute(h, attr_icflag)
+ local ic = node.has_attribute(h, attr_icflag) or 0
return (ic<PROCESSED_BEGIN_FLAG)
and (node.has_attribute(h,attr_dir)%dir_node_auto) or 0
else
if getid(hd)==id_whatsit and
getsubtype(hd)==sid_user and getfield(hd, 'user_id')==DIR then
set_attr(hd, attr_icflag,
- (has_attr(hd, attr_icflag) or 0)%PROCESSED_BEGIN_FLAG
- + PROCESSED_BEGIN_FLAG)
+ get_attr_icflag(hd) + PROCESSED_BEGIN_FLAG)
tex_set_attr('global', attr_icflag, 0)
return hd
else
local x, new_dir = hd, ltjs.list_dir or dir_yoko
while x do
local xid = getid(x)
- if (xid==id_hlist and has_attr(x, attr_icflag)%PROCESSED_BEGIN_FLAG~=PACKED)
+ if (xid==id_hlist and get_attr_icflag(x)~=PACKED)
or xid==id_vlist then
hd, x = make_dir_whatsit(hd, x, new_dir, 'process_dir_node:' .. gc)
else
function luatexja.direction.remove_end_whatsit()
local h=tex.lists.page_head
- if (not h.next) and
+ if h and (not h.next) and
h.id==id_whatsit and h.subtype==sid_user and
h.user_id == DIR then
tex.lists.page_head = nil
\directlua{% This value depends on the version of LuaTeX.
luatexja.stack.hmode = -tex.nest[tex.nest.ptr].mode
}%
- $\directlua{% This value depends on the version of LuaTeX.
- luatexja.stack.mmode = -tex.nest[tex.nest.ptr].mode
- }$%
}
\setbox0\vbox{%
\directlua{% This value depends on the version of LuaTeX.
end
}%
}
+\setbox0\hbox{%
+ $\directlua{% This value depends on the version of LuaTeX.
+ luatexja.stack.mmode = -tex.nest[tex.nest.ptr].mode
+ }$%
+}
+
%%%% \raise, \lower, \moveleft, \moveright
\let\ltj@@orig@raise=\raise