From c14cdc4c0bd5b79c5be5a24844b3ab3d7a4874ed Mon Sep 17 00:00:00 2001 From: Hironori Kitagawa Date: Mon, 8 May 2017 21:22:47 +0900 Subject: [PATCH] Fix #37164 --- src/ltj-direction.lua | 3 +-- src/ltj-latex.sty | 1 + src/luatexja-core.sty | 1 + src/patches/lltjp-preview.sty | 16 ++++++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 src/patches/lltjp-preview.sty diff --git a/src/ltj-direction.lua b/src/ltj-direction.lua index 5228662..9d650f2 100644 --- a/src/ltj-direction.lua +++ b/src/ltj-direction.lua @@ -530,7 +530,7 @@ do start_time_measure('box_primitive_hook') local list_dir = get_dir_count()%dir_math_mod local b = getbox(tex_getcount('ltj@tempcnta')) - if b then + if b and getlist(to_direct(b)) then local box_dir = get_box_dir(to_direct(b), dir_yoko) if box_dir%dir_math_mod ~= list_dir then ltjb.package_error( @@ -1159,7 +1159,6 @@ do finalize_inner(shipout_temp) setbox('global', "AtBeginShipoutBox", copy(getlist(shipout_temp))) setfield(shipout_temp, 'head',nil) - -- garbage collect --local m = collectgarbage('count') --if m>lua_mem_kb+20480 then diff --git a/src/ltj-latex.sty b/src/ltj-latex.sty index 16b5c2b..7401aa4 100644 --- a/src/ltj-latex.sty +++ b/src/ltj-latex.sty @@ -78,6 +78,7 @@ \ltj@asc@temp\let\ltj@asc@temp=\relax }{}}% ascmac \ltj@pkgpatch{stfloats} +\ltj@pkgpatch{preview} \RequirePackage{lltjp-geometry} \RequirePackage{filehook} diff --git a/src/luatexja-core.sty b/src/luatexja-core.sty index ce109e4..91544dd 100644 --- a/src/luatexja-core.sty +++ b/src/luatexja-core.sty @@ -79,6 +79,7 @@ \RequirePackage{pdftexcmds} [2011/11/29] % v0.20 \RequirePackage{xkeyval} [2012/10/14] % v2.6b \RequirePackage{atbegshi} + \AtBeginShipoutInit \IfFileExists{everyhook.sty}{\RequirePackage{everyhook}\ltj@everyhook@availtrue}{} \else %<*!LaTeX> \input luatexbase.sty diff --git a/src/patches/lltjp-preview.sty b/src/patches/lltjp-preview.sty new file mode 100644 index 0000000..f8a90ef --- /dev/null +++ b/src/patches/lltjp-preview.sty @@ -0,0 +1,16 @@ +% +% lltjp-preview.sty +% + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{lltjp-preview}[2017/05/08 Patch to preview for LuaTeX-ja] + +\RequirePackage{etoolbox,preview,luatexja} + +\patchcmd\pr@endbox{% + \pr@ship@end +}{% + \setbox\pr@box\hbox{\yoko\box\pr@box}\pr@ship@end +}{}{} + +\endinput -- 2.11.0