\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja-core}[2017/11/12 Core of LuaTeX-ja]
+ \ProvidesPackage{luatexja-core}[2021-05-11 Core of LuaTeX-ja]
\fi %</LaTeX>
%% Load prerequisite packages.
\RequirePackage{ltxcmds} [2011/11/09] % v1.22
\RequirePackage{pdftexcmds} [2011/11/29] % v0.20
\RequirePackage{xkeyval} [2012/10/14] % v2.6b
- \RequirePackage{atbegshi}
\RequirePackage{etoolbox}
- \AtBeginShipoutInit
\IfFileExists{everyhook.sty}{\RequirePackage{everyhook}\ltj@everyhook@availtrue}{}
\else %<*!LaTeX>
\input luatexbase.sty
\input ltxcmds.sty
\input pdftexcmds.sty
\input xkeyval
- \input atbegshi.sty
- \AtBeginShipoutInit
\fi %</LaTeX>
\endlinechar=-1 %
\def\ltj@loaded{hoge}
-\newdimen\ltj@zw
-\newdimen\ltj@zh
-\newdimen\jQ \jQ=0.25mm
-\let\jH=\jQ
+\newdimen\ltj@dimen@zw
+\newdimen\ltj@dimen@zh
+\newdimen\ltj@dimen@jQ \ltj@dimen@jQ=0.25mm
+\let\jQ=\ltj@dimen@jQ \let\jH=\jQ
%%%%%%%% error message
\def\ltj@defnum{0}
\newattribute\ltj@icflag % attribute for italic correction
\newattribute\ltj@curjfnt % index for ``current horizontal Japanese font''
\newattribute\ltj@curtfnt % index for ``current vertical Japanese font''
-\newattribute\ltj@origchar %
\newattribute\ltj@charclass %
\newattribute\ltj@charcode %
\newattribute\ltj@autospc % attribute for autospacing
\newattribute\ltj@tablshift % attribute for talbaselineshift
\newattribute\ltj@tkblshift % attribute for tjabaselineshift
\newattribute\jfam % index for current jfam
+\newattribute\ltj@vert@ori % <=0: UAX#50, >0: always upright
\newattribute\ltj@dir
\newlanguage\ltj@@japanese
\ltj@dir\z@
\ltj@icflag\z@
-\ltj@origchar\z@
\ltj@charclass\z@
\ltj@curjfnt\m@ne
\ltj@curtfnt\m@ne
+\ltj@yablshift\z@
+\ltj@ykblshift\z@
+\ltj@tablshift\z@
+\ltj@tkblshift\z@
%%%%%%%% Attributes for character ranges
\newcount\ltj@tempcnta
%%%%%%%% Redefine \/
\newluafunction\ltj@@italic@inner
+\newluafunction\ltj@@start@time@measure@inner
+\newluafunction\ltj@@stop@time@measure@inner
\directlua{
local t = lua.get_functions_table()
+ local start_time_measure = luatexja.base.start_time_measure
+ local stop_time_measure = luatexja.base.stop_time_measure
+ local scan_arg = token.scan_argument
t[\the\ltj@@italic@inner] = luatexja.jfont.append_italic
+ t[\the\ltj@@start@time@measure@inner] = function()
+ start_time_measure(scan_arg())
+ end
+ t[\the\ltj@@stop@time@measure@inner] = function()
+ stop_time_measure(scan_arg())
+ end
}
-\protected\def\/{\relax\luafunction\ltj@@italic@inner}
+\begingroup\catcode`\/=11
+\protected\gdef\ltj@@/{\relax\luafunction\ltj@@italic@inner}
+\global\let\/\ltj@@/ %% PRIMITIVE
+\endgroup
+\luadef\ltj@@start@time@measure\ltj@@start@time@measure@inner
+\luadef\ltj@@stop@time@measure\ltj@@stop@time@measure@inner
%%%%%%%% \jfont\CS={...:...;jfm=metric;...}, \globaljfont
\protected\def\jfont#1{%
\newluafunction\ltj@zh@inner
\directlua{
local t, setdimen, ltjf = lua.get_functions_table(), tex.setdimen, luatexja.jfont
- t[\the\ltj@zw@inner] = function() setdimen('ltj@zw', ltjf.get_zw()) end
- t[\the\ltj@zh@inner] = function() setdimen('ltj@zh', ltjf.get_zh()) end
+ t[\the\ltj@zw@inner] = function() setdimen('ltj@dimen@zw', ltjf.get_zw()) end
+ t[\the\ltj@zh@inner] = function() setdimen('ltj@dimen@zh', ltjf.get_zh()) end
}
-\protected\def\zw{\luafunction\ltj@zw@inner\ltj@zw}
-\protected\def\zh{\luafunction\ltj@zh@inner\ltj@zh}
+\protected\def\ltj@zw{\luafunction\ltj@zw@inner\ltj@dimen@zw}
+\protected\def\ltj@zh{\luafunction\ltj@zh@inner\ltj@dimen@zh}
+\let\zw=\ltj@zw
+\let\zh=\ltj@zh
%%%%%%%% \inhibitglue
\newluafunction\ltj@reset@globaldefs@inner
\newluafunction\ltj@restore@globaldefs@inner
+\newluafunction\ltj@@disihb@inner
\newluafunction\ltj@@ihb@inner
\newluafunction\ltj@@fakeparbegin@inner
\newluafunction\ltj@@fakeboxbdd@inner
+\newluafunction\ltj@@ins@xk@inner
+\newluafunction\ltj@@ins@k@inner
\directlua{
local t = lua.get_functions_table()
t[\the\ltj@reset@globaldefs@inner]
= function() luatexja.global_temp = tex.globaldefs; tex.globaldefs = 0 end
t[\the\ltj@restore@globaldefs@inner]
= function() tex.globaldefs = luatexja.global_temp end
+ t[\the\ltj@@disihb@inner] = luatexja.jfmglue.create_disinhibitglue_node
t[\the\ltj@@ihb@inner] = luatexja.jfmglue.create_inhibitglue_node
t[\the\ltj@@fakeparbegin@inner] = luatexja.jfmglue.create_beginpar_node
t[\the\ltj@@fakeboxbdd@inner] = luatexja.jfmglue.create_boxbdd_node
+ t[\the\ltj@@ins@xk@inner] = luatexja.jfmglue.insert_xk_skip
+ t[\the\ltj@@ins@k@inner] = luatexja.jfmglue.insert_k_skip
}
-\protected\def\ltj@reset@globaldefs{\luafunction\ltj@reset@globaldefs@inner}
-\protected\def\ltj@restore@globaldefs{\luafunction\ltj@restore@globaldefs@inner}
+\protected\luadef\ltj@reset@globaldefs \ltj@reset@globaldefs@inner
+\protected\luadef\ltj@restore@globaldefs\ltj@restore@globaldefs@inner
+\protected\def\disinhibitglue{\ifhmode\relax\luafunction\ltj@@disihb@inner\fi}
\protected\def\inhibitglue{\ifhmode\relax\luafunction\ltj@@ihb@inner\fi}
\protected\def\ltjfakeparbegin{\ifhmode\relax\luafunction\ltj@@fakeparbegin@inner\fi}
\protected\def\ltjfakeboxbdd{\ifhmode\relax\luafunction\ltj@@fakeboxbdd@inner\fi}
+\protected\luadef\insertxkanjiskip \ltj@@ins@xk@inner
+\protected\luadef\insertkanjiskip \ltj@@ins@k@inner
%%%%%%%% \ltjdefcharrange<name>{100-200,3000-,5000,...}
local d = scan_glue(); sss(sti.XSK, d); node.free(d)
end
}
-\protected\def\ltjsetkanjiskip{\luafunction\ltjsetkanjiskip@inner}
-\protected\def\ltjsetxkanjiskip{\luafunction\ltjsetxkanjiskip@inner}
+\protected\luadef\ltjsetkanjiskip \ltjsetkanjiskip@inner
+\protected\luadef\ltjsetxkanjiskip\ltjsetxkanjiskip@inner
% jcharwidowpenalty = <count>
\define@key[ltj]{japaram}{jcharwidowpenalty}{% %COUNT
\directlua{luatexja.jfmglue.diffmet_rule = math.two_paverage}\or
\directlua{luatexja.jfmglue.diffmet_rule = math.two_add}
\fi
-}{\ltj@PackageError{luatexja}{invalid argument `#1' for `differentjfm'}{%
+}{\@PackageError{luatexja}{invalid argument `#1' for `differentjfm'}{%
Argument for `differentjfm' must be one of `large', `small', `average',^^J%
`pleft', `pright', 'paverage' or `both'. }}
% large, small, average, pleft, pright, paverage, both
\else\directlua{luatexja.isglobal=''}\fi
}
\protected\def\ltjsetparameter#1{%
- \directlua{luatexja.base.start_time_measure('set_par')}%
+ \ltj@@start@time@measure{set_par}%
\ltj@setpar@global\setkeys[ltj]{japaram}{#1}%
- \directlua{luatexja.base.stop_time_measure('set_par')}%
+ \ltj@@stop@time@measure{set_par}%
\ignorespaces}
\protected\def\ltjglobalsetparameter#1{%
\relax\ifnum\globaldefs<0\directlua{luatexja.isglobal=''}%
\else\directlua{luatexja.isglobal='global'}\fi%
- \directlua{luatexja.base.start_time_measure('set_par')}%
+ \ltj@@start@time@measure{set_par}%
\setkeys[ltj]{japaram}{#1}%
- \directlua{luatexja.base.stop_time_measure('set_par')}%
+ \ltj@@stop@time@measure{set_par}%
\ignorespaces}
%%%%%%%% \ltjgetparameter
\ltj@@decl@array@param{chartorange}
\ltj@@decl@array@param{boxdir}
\def\ltjgetparameter#1{%
- \directlua{luatexja.base.start_time_measure('get_par')}%
+ \ltj@@start@time@measure{get_par}%
% stop call is moved in luatexja.lua
\ifcsname ltj@@array@param/#1\endcsname
\expandafter\ltx@firstoftwo
{\ltj@@getparam@two{#1}}%
{\ltj@@getparam@one{#1}}%
}
-\def\ltj@@getparam@one#1{%
- \directlua{luatexja.ext_get_parameter_unary('#1')}%
-}%
+\newluafunction\ltj@@getparam@one@inner
+\directlua{
+ local t = lua.get_functions_table()
+ t[\the\ltj@@getparam@one@inner] = luatexja.ext_get_parameter_unary
+}
+\luadef\ltj@@getparam@one\ltj@@getparam@one@inner
\def\ltj@@getparam@two#1#2{%
\directlua{luatexja.ext_get_parameter_binary('#1', \ltj@safe@num@or{nil}{#2})}%
}
%%%%%%%% \ltjalchar<number>, \ltjjachar<number>
\let\ltj@@origchar=\char
-\protected\def\ltj@alljachar{\relax
- \csname ltj@kcat0\endcsname\z@
- \csname ltj@kcat1\endcsname\z@
- \csname ltj@kcat2\endcsname\z@
- \csname ltj@kcat3\endcsname\z@
- \csname ltj@kcat4\endcsname\z@
- \csname ltj@kcat5\endcsname\z@
- \csname ltj@kcat6\endcsname\z@}
+\newluafunction\ltj@alljachar@inner
+\directlua{
+ local t, set_attr = lua.get_functions_table(), tex.setattribute
+ local get_attr, floor = tex.getattribute, math.floor
+ local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
+ local lang_ja = luatexja.lang_ja
+ t[\the\ltj@alljachar@inner] = function()
+ font.current(get_attr(attr_curjfnt)); tex.language=lang_ja;
+ for i=0,6 do
+ set_attr(luatexbase.attributes['ltj@kcat' .. floor(i)],0)
+ end
+ end
+}
+\protected\luadef\ltj@alljachar\ltj@alljachar@inner
\protected\def\ltj@allalchar{\relax
\csname ltj@kcat0\endcsname="7FFFFFFF %"
\csname ltj@kcat1\endcsname="7FFFFFFF %"
\csname ltj@kcat5\endcsname="7FFFFFFF %"
\csname ltj@kcat6\endcsname="7FFFFFFF }%"
-\protected\def\ltjjachar{\afterassignment\ltj@@jachar\ltj@tempcnta}
+\protected\def\ltjjachar{\leavevmode\afterassignment\ltj@@jachar\ltj@tempcnta}
\def\ltj@@jachar{{\directlua{tex.globaldefs=0}\ltj@alljachar\ltj@@origchar\ltj@tempcnta}}
-\protected\def\ltjalchar{\afterassignment\ltj@@alchar\ltj@tempcnta}
+\protected\def\ltjalchar{\leavevmode\afterassignment\ltj@@alchar\ltj@tempcnta}
\def\ltj@@alchar{{\directlua{tex.globaldefs=0}\ltj@allalchar\ltj@@origchar\ltj@tempcnta}}
%%%%%%%% \ltjsetmathletter<number>, \ltjunsetmathletter<number>
\yoko
%%%% insert
-\let\orig@insert=\insert
-\protected\def\insert{\begingroup\afterassignment\ltj@@insert@A\ltj@tempcnta}
-\protected\def\ltj@@insert@A{\orig@insert\ltj@tempcnta\bgroup
+\let\ltj@@orig@insert\insert
+\newluafunction\ltj@@lua@populate@insertwhatsit@inner
+\directlua{
+ local t = lua.get_functions_table()
+ t[\the\ltj@@lua@populate@insertwhatsit@inner]
+ = luatexja.direction.populate_insertion_dir_whatsit
+}
+\luadef\ltj@@lua@populate@insertwhatsit\ltj@@lua@populate@insertwhatsit@inner
+\protected\def\ltj@@insert{\begingroup\afterassignment\ltj@@insert@A\ltj@tempcnta}
+\let\insert\ltj@@insert %% PRIMITIVE
+\protected\def\ltj@@insert@A{\ltj@@orig@insert\ltj@tempcnta\bgroup
\aftergroup\ltj@@insert@B\let\ltj@@next}
-\protected\def\ltj@@insert@B{\directlua{luatexja.direction.populate_insertion_dir_whatsit()}\endgroup}
+\protected\def\ltj@@insert@B{\ltj@@lua@populate@insertwhatsit\endgroup}
%%%% vadjust
-\let\ltj@@orig@vadjust=\vadjust
-\protected\def\vadjust{%
+\let\ltj@@orig@vadjust\vadjust
+\protected\def\ltj@@vadjust{%
\ltj@@orig@vadjust\bgroup
\directlua{luatexja.direction.set_list_direction_hook('adj')}%
\aftergroup\ltj@@vadjust@check@dir\let\ltj@@next}
+\let\vadjust\ltj@@vadjust %% PRIMITIVE
\protected\def\ltj@@vadjust@check@dir{%
\directlua{luatexja.direction.check_adjust_direction()}%
}
%%%% \hbox, \vbox, \vtop
\setbox\z@\hbox{%
- \primitive\everymath{}
+ \primitive\everymath{}%
$\directlua{% This value depends on the version of LuaTeX.
luatexja.stack.mmode = -tex.nest[tex.nest.ptr].mode
}$%
}
\setbox\z@\box\voidb@x
-\ifltj@everyhook@avail% using everyhook package
- \newluafunction\ltj@@box@dirhook
- \directlua{
- local t, ltjd = lua.get_functions_table(), luatexja.direction
- t[\the\ltj@@box@dirhook]
- = function() ltjd.set_list_direction_hook() end
- }
- \PushPreHook{hbox}{\luafunction\ltj@@box@dirhook\aftergroup\ltj@@reset@badness}
- \PushPreHook{vbox}{\luafunction\ltj@@box@dirhook\aftergroup\ltj@@reset@badness}
-\else
- \let\ltj@@everyhbox=\everyhbox\let\ltj@@everyvbox=\everyvbox
- \newtoks\ltj@@i@everyhbox\newtoks\ltj@@i@everyvbox
- \let\everyhbox=\ltj@@i@everyhbox\let\everyvbox=\ltj@@i@everyvbox
- \newluafunction\ltj@@box@dirhook
- \directlua{
- local t, ltjd = lua.get_functions_table(), luatexja.direction
- t[\the\ltj@@box@dirhook]
- = function() ltjd.set_list_direction_hook() end
- }
- \ltj@@everyhbox{\luafunction\ltj@@box@dirhook
- \aftergroup\ltj@@reset@badness\the\ltj@@i@everyhbox}
- \ltj@@everyvbox{\luafunction\ltj@@box@dirhook
- \aftergroup\ltj@@reset@badness\the\ltj@@i@everyvbox}
-\fi
-
+\newluafunction\ltj@@box@dirhook@inner
\newluafunction\ltj@@reset@badness@inner
\directlua{
- local t = lua.get_functions_table()
- t[\the\ltj@@reset@badness@inner] = function()
+ local t, ltjd = lua.get_functions_table(), luatexja.direction
+ t[\the\ltj@@box@dirhook@inner]
+ = function() ltjd.set_list_direction_hook() end
+ t[\the\ltj@@reset@badness@inner] = function()
if luatexja.global_temp then
tex.hbadness= tex.hbadness or luatexja.hbadness_temp
tex.vbadness= tex.vbadness or luatexja.vbadness_temp
tex.globaldefs= luatexja.global_temp or tex.globaldefs
end
- end}
-\protected\def\ltj@@reset@badness{\luafunction\ltj@@reset@badness@inner}
+ end
+}
+\luadef\ltj@@box@dirhook\ltj@@box@dirhook@inner
+\ifltj@everyhook@avail% using everyhook package
+ \PushPreHook{hbox}{\ltj@@box@dirhook\aftergroup\ltj@@reset@badness}
+ \PushPreHook{vbox}{\ltj@@box@dirhook\aftergroup\ltj@@reset@badness}
+\else
+ \let\ltj@@everyhbox\everyhbox\let\ltj@@everyvbox\everyvbox
+ \newtoks\ltj@@i@everyhbox\newtoks\ltj@@i@everyvbox
+ \let\everyhbox\ltj@@i@everyhbox\let\everyvbox\ltj@@i@everyvbox
+ \ltj@@everyhbox{\ltj@@box@dirhook
+ \aftergroup\ltj@@reset@badness\the\ltj@@i@everyhbox}
+ \ltj@@everyvbox{\ltj@@box@dirhook
+ \aftergroup\ltj@@reset@badness\the\ltj@@i@everyvbox}
+\fi
-\AtBeginShipout{\directlua{luatexja.direction.finalize()}}
+\luadef\ltj@@reset@badness\ltj@@reset@badness@inner
%%%% \raise, \lower, \moveleft, \moveright
-\let\ltj@@orig@raise=\raise
-\let\ltj@@orig@lower=\lower
-\protected\def\raise{\ltj@reset@globaldefs\afterassignment\ltj@@raise\ltj@tempdima}
-\protected\def\lower{\ltj@reset@globaldefs\afterassignment\ltj@@raise\ltj@tempdima-}
-\protected\def\ltj@@raise{%
+\newluafunction\ltj@@lua@raisebox@inner
+\directlua{
+ local t = lua.get_functions_table()
+ t[\the\ltj@@lua@raisebox@inner]=luatexja.direction.raise_box
+}
+\protected\luadef\ltj@@lua@raisebox\ltj@@lua@raisebox@inner
+\let\ltj@@orig@raise\raise
+\let\ltj@@orig@lower\lower
+\protected\def\ltj@@raise{\ltj@reset@globaldefs\afterassignment\ltj@@raise@\ltj@tempdima}
+\protected\def\ltj@@lower{\ltj@reset@globaldefs\afterassignment\ltj@@raise@\ltj@tempdima-}
+\protected\def\ltj@@raise@{%
\ltj@restore@globaldefs
\edef\ltj@@raise@a{%
- \noexpand\directlua{luatexja.direction.raise_box()}%
- \ltj@@orig@raise\the\ltj@tempdima\noexpand\box\ltj@afbox
+ \ltj@@lua@raisebox\ltj@@orig@raise\the\ltj@tempdima\noexpand\box\ltj@afbox
}\ltj@afterbox\ltj@@raise@a}
-\let\ltj@@orig@moveleft=\moveleft
-\let\ltj@@orig@moveright=\moveright
-\protected\def\moveleft{\ltj@reset@globaldefs\afterassignment\ltj@@moveleft\ltj@tempdima}
-\protected\def\moveright{\ltj@reset@globaldefs\afterassignment\ltj@@moveleft\ltj@tempdima-}
-\protected\def\ltj@@moveleft{%
+\let\ltj@@orig@moveleft\moveleft
+\let\ltj@@orig@moveright\moveright
+\protected\def\ltj@@moveleft{\ltj@reset@globaldefs\afterassignment\ltj@@moveleft@\ltj@tempdima}
+\protected\def\ltj@@moveright{\ltj@reset@globaldefs\afterassignment\ltj@@moveleft@\ltj@tempdima-}
+\protected\def\ltj@@moveleft@{%
\ltj@restore@globaldefs
\edef\ltj@@moveleft@a{%
- \noexpand\directlua{luatexja.direction.raise_box()}%
- \ltj@@orig@moveleft\the\ltj@tempdima\noexpand\box\ltj@afbox
+ \ltj@@lua@raisebox\ltj@@orig@moveleft\the\ltj@tempdima\noexpand\box\ltj@afbox
}\ltj@afterbox\ltj@@moveleft@a}
+\let\raise\ltj@@raise %% PRIMITIVE
+\let\lower\ltj@@lower %% PRIMITIVE
+\let\moveleft\ltj@@moveleft %% PRIMITIVE
+\let\moveright\ltj@@moveright %% PRIMITIVE
%%%%\vsplit
-\let\ltj@@orig@vsplit=\vsplit
-\protected\def\vsplit{\directlua{luatexja.direction.vsplit()}}
+\let\ltj@@orig@vsplit\vsplit
+\protected\def\ltj@@vsplit{\directlua{luatexja.direction.vsplit()}}
+\let\vsplit\ltj@@vsplit %% PRIMITIVE
+
%%%% \vcenter
-\let\ltj@@orig@vcenter=\vcenter
-\protected\def\vcenter{\ltj@afterbox\ltj@@vcenter\vbox}
-\protected\def\ltj@@vcenter{%
- \directlua{luatexja.direction.raise_box()}%
- \ltj@@orig@vcenter{\box\ltj@afbox}%
+\let\ltj@@orig@vcenter\vcenter
+\protected\def\ltj@@vcenter{\ltj@afterbox\ltj@@vcenter@\vbox}
+\protected\def\ltj@@vcenter@{%
+ \ltj@@lua@raisebox\ltj@@orig@vcenter{\box\ltj@afbox}%
}
+\let\vcenter\ltj@@vcenter %% PRIMITIVE
%%%% \unhbox and \unvbox
+\newluafunction\ltj@@lua@unboxcheckdir@inner
+\directlua{
+ local t = lua.get_functions_table()
+ t[\the\ltj@@lua@unboxcheckdir@inner]=luatexja.direction.unbox_check_dir
+}
+\luadef\ltj@@lua@unboxcheckdir\ltj@@lua@unboxcheckdir@inner
\long\def \@gobbletwo #1#2{}
-\let\ltj@@orig@unhbox=\unhbox
-\let\ltj@@orig@unvbox=\unvbox
-\protected\def\unhbox{\ltj@reset@globaldefs\afterassignment\ltj@@unhbox\ltj@tempcnta}
-\protected\def\unvbox{\ltj@reset@globaldefs\afterassignment\ltj@@unvbox\ltj@tempcnta}
-\protected\def\ltj@@unhbox{%
- \directlua{luatexja.direction.unbox_check_dir()}%
- \ltj@@orig@unhbox\ltj@tempcnta}
-\protected\def\ltj@@unvbox{%
- \directlua{luatexja.direction.unbox_check_dir()}%
- \ltj@@orig@unvbox\ltj@tempcnta}
-\let\ltj@@orig@unhcopy=\unhcopy
-\let\ltj@@orig@unvcopy=\unvcopy
-\protected\def\unhcopy{\ltj@reset@globaldefs\afterassignment\ltj@@unhcopy\ltj@tempcnta}
-\protected\def\unvcopy{\ltj@reset@globaldefs\afterassignment\ltj@@unvcopy\ltj@tempcnta}
-\protected\def\ltj@@unhcopy{%
+\let\ltj@@orig@unhbox\unhbox
+\let\ltj@@orig@unvbox\unvbox
+\protected\def\ltj@@unhbox{\ltj@reset@globaldefs\afterassignment\ltj@@unhbox@\ltj@tempcnta}
+\protected\def\ltj@@unvbox{\ltj@reset@globaldefs\afterassignment\ltj@@unvbox@\ltj@tempcnta}
+\protected\def\ltj@@unhbox@{\ltj@@lua@unboxcheckdir\ltj@@orig@unhbox\ltj@tempcnta}
+\protected\def\ltj@@unvbox@{\ltj@@lua@unboxcheckdir\ltj@@orig@unvbox\ltj@tempcnta}
+\let\ltj@@orig@unhcopy\unhcopy
+\let\ltj@@orig@unvcopy\unvcopy
+\protected\def\ltj@@unhcopy{\ltj@reset@globaldefs\afterassignment\ltj@@unhcopy@\ltj@tempcnta}
+\protected\def\ltj@@unvcopy{\ltj@reset@globaldefs\afterassignment\ltj@@unvcopy@\ltj@tempcnta}
+\protected\def\ltj@@unhcopy@{%
\directlua{luatexja.direction.unbox_check_dir(true)}%
\ltj@@orig@unhcopy\ltj@tempcnta
\directlua{luatexja.direction.uncopy_restore_whatsit()}}
-\protected\def\ltj@@unvcopy{%
+\protected\def\ltj@@unvcopy@{%
\directlua{luatexja.direction.unbox_check_dir(true)}%
\ltj@@orig@unvcopy\ltj@tempcnta
\directlua{luatexja.direction.uncopy_restore_whatsit()}}
+\let\unhbox\ltj@@unhbox %% PRIMITIVE
+\let\unvbox\ltj@@unvbox %% PRIMITIVE
+\let\unhcopy\ltj@@unhcopy %% PRIMITIVE
+\let\unvcopy\ltj@@unvcopy %% PRIMITIVE
%%%% lastbox
\let\ltj@@orig@lastbox=\lastbox
-\protected\def\lastbox{%
- \directlua{luatexja.direction.lastbox_hook()}\ltj@@orig@lastbox
-}
+\protected\def\ltj@@lastbox{\directlua{luatexja.direction.lastbox_hook()}\ltj@@orig@lastbox}
+\let\lastbox\ltj@@lastbox %% PRIMITIVE
%%%%%%%% \ltjgetwd<box_num> etc.
-\def\ltj@@getwd{%
- \directlua{luatexja.direction.get_box_dim('width', token.scan_int())}}
-\def\ltj@@getht{%
- \directlua{luatexja.direction.get_box_dim('height', token.scan_int())}}
-\def\ltj@@getdp{%
- \directlua{luatexja.direction.get_box_dim('depth', token.scan_int())}}
+\def\ltj@@getwd{\directlua{luatexja.direction.get_box_dim('width', token.scan_int())}}
+\def\ltj@@getht{\directlua{luatexja.direction.get_box_dim('height', token.scan_int())}}
+\def\ltj@@getdp{\directlua{luatexja.direction.get_box_dim('depth', token.scan_int())}}
\let\ltjgetwd=\ltj@@getwd\let\ltjgetht=\ltj@@getht\let\ltjgetdp=\ltj@@getdp
%%%%%%%% \ltjsetwd<box_num>=<dimen> etc.
%%------------------ Load module for the format
+\directlua{luatexja.load_kinsoku()}
\ifltj@in@latex %<*LaTeX>
\RequirePackage{ltj-latex}
\else\ifltj@in@plain %<*plain>