From 107ebba3ea5e77e8a9a502b8d874a9c0c86c71a3 Mon Sep 17 00:00:00 2001 From: Hironori Kitagawa Date: Sat, 31 Dec 2016 14:41:16 +0900 Subject: [PATCH] Fix ticket #36913 --- src/lltjext.sty | 2 +- src/ltj-direction.lua | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/lltjext.sty b/src/lltjext.sty index 02557dc..b814bbe 100644 --- a/src/lltjext.sty +++ b/src/lltjext.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjext}[2015/12/16 v1.2c-ltj-5 Macros for vertical writing] +\ProvidesPackage{lltjext}[2016/12/16 v1.2c-ltj-5 Macros for vertical writing] \RequirePackage{luatexja} {\catcode`\*=11 diff --git a/src/ltj-direction.lua b/src/ltj-direction.lua index 0947f34..5228662 100644 --- a/src/ltj-direction.lua +++ b/src/ltj-direction.lua @@ -106,14 +106,14 @@ do end end function get_dir_count() - for i=tex_nest.ptr, 1, -1 do - local h = tex_nest[i].head.next - if h then - local t = get_dir_count_inner(h) - if t~=0 then return t end - end - end - return page_direction + for i=tex_nest.ptr, 1, -1 do + local h = tex_nest[i].head.next + if h then + local t = get_dir_count_inner(h) + if t~=0 then return t end + end + end + return page_direction end function get_adjust_dir_count() for i=tex_nest.ptr, 1, -1 do @@ -951,6 +951,9 @@ do local list_dir = get_dir_count() local a = tex_nest[tex_nest.ptr].tail local ad = to_direct(a) + if (not a) or getid(ad)~=id_ins then + a = node.tail(tex.lists.page_head); ad = to_direct(a) + end if a and getid(ad)==id_ins then local h = getfield(ad, 'head') if getid(h)==id_whatsit and -- 2.11.0