From dbf06c3ecc6528bd2410630d2a251940ec0c9b23 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Tue, 21 Apr 2015 23:46:31 +0000
Subject: luatexja (21apr15)

git-svn-id: svn://tug.org/texlive/trunk@36992 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/luatex/luatexja/patches/lltjcore.sty       | 91 ++++++++++++++++++++--
 1 file changed, 85 insertions(+), 6 deletions(-)

(limited to 'Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty')

diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty
index 2d8afbd512a..94254e77222 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty
@@ -6,7 +6,18 @@
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{lltjcore}[2013/05/14 Patch to LaTeX2e Kernel for LuaTeX-ja]
 
-\makeatletter
+\def\cleardoublepage{\clearpage\if@twoside
+  \ifodd\c@page
+    \ifnum\ltjgetparameter{direction}=3
+      \hbox{}\thispagestyle{empty}\newpage
+      \if@twocolumn\hbox{}\newpage\fi
+    \fi
+  \else
+    \ifnum\ltjgetparameter{direction}=4
+      \hbox{}\thispagestyle{empty}\newpage
+      \if@twocolumn\hbox{}\newpage\fi
+    \fi
+  \fi\fi}
 \newif\iftombow \tombowfalse
 \newif\iftombowdate \tombowdatetrue
 \newdimen\@tombowwidth
@@ -89,7 +100,7 @@
 \newdimen\@@topmargin
 \def\@outputpage{%
 \begingroup % the \endgroup is put in by \aftergroup
-  \iftdir
+  \ifnum\ltjgetparameter{direction}=4\else
     \dimen\z@\textwidth \textwidth\textheight \textheight\dimen\z@
   \fi
   \let \protect \noexpand
@@ -106,11 +117,11 @@
      \fi
      \if@twoside
        \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
-          \iftdir\let\@themargin\evensidemargin
+          \ifnum\ltjgetparameter{direction}=3 \let\@themargin\evensidemargin
           \else\let\@themargin\oddsidemargin\fi
        \else \let\@thehead\@evenhead
           \let\@thefoot\@evenfoot
-           \iftdir\let\@themargin\oddsidemargin
+           \ifnum\ltjgetparameter{direction}=3 \let\@themargin\oddsidemargin
            \else\let\@themargin\evensidemargin\fi
      \fi\fi
      \@@topmargin\topmargin
@@ -153,7 +164,35 @@
   \stepcounter{page}%
   \let\firstmark\botmark
 }
-
+\renewcommand\@makefnmark{\hbox{%
+  \unless\ifnum\ltjgetparameter{direction}=3
+    \@textsuperscript{\normalfont\@thefnmark}%
+  \else\hbox{\yoko \@textsuperscript{\normalfont\@thefnmark}}\fi}}
+\long\def\@footnotetext#1{%
+  \ifcase\ltjgetparameter{direction}%
+    \or   \let\@tempa\dtou
+    \or\or\let\@tempa\tate
+    \or   \let\@tempa\yoko
+    \else \let\@tempa\utod
+  \fi
+  \insert\footins{\@tempa%
+    \reset@font\footnotesize
+    \interlinepenalty\interfootnotelinepenalty
+    \splittopskip\footnotesep
+    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+    \hsize\columnwidth \@parboxrestore
+    \protected@edef\@currentlabel{%
+       \csname p@footnote\endcsname\@thefnmark
+    }%
+    \color@begingroup
+      \@makefntext{%
+        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
+    \color@endgroup}}
+\def\@footnotemark{\leavevmode
+  \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
+  \unless\ifnum\ltjgetparameter{direction}=3 \@makefnmark
+  \else\hbox to\z@{\hskip-.25\zw\raise.9\zh\@makefnmark\hss}\fi
+  \ifhmode\spacefactor\@x@sf\fi\relax}
 \def\@setref#1#2#3{%
   \ifx#1\relax
     \protect\G@refundefinedtrue
@@ -169,10 +208,50 @@
     \verb@eol@error \let\do\@makeother \dospecials
     \verbatim@font\@noligs
     \@ifstar\@sverb\@verb}
-\def\@makefnmark{\hbox{}\hbox{\@textsuperscript{\normalfont\@thefnmark}}\hbox{}}
 \fi
 \gdef\@stopfield{\null\color@endgroup\egroup}
 \newcount\hour
 \newcount\minute
 
+%%% AtBeginDvi
+\def \AtBeginDvi #1{%
+  \global \setbox \@begindvibox
+    \vbox{\yoko\unvbox \@begindvibox #1}%
+}
+
+%%% @makecol
+\gdef \@makecol {%
+   \ifvoid\footins
+     \setbox\@outputbox \box\@cclv
+   \else
+     \setbox\@outputbox \vbox {%
+       \boxmaxdepth \@maxdepth
+       \unvbox \@cclv
+       \vskip \skip\footins
+       \color@begingroup
+         \normalcolor
+         \footnoterule
+         \unvbox \footins
+       \color@endgroup
+       }%
+   \fi
+   \let\@elt\relax
+   \xdef\@freelist{\@freelist\@midlist}%
+   \global \let \@midlist \@empty
+   \@combinefloats
+   \ifvbox\@kludgeins
+     \@makespecialcolbox
+   \else
+     \setbox\@outputbox \vbox to\@colht {%
+       \@texttop
+       \dimen@ \dp\@outputbox
+       \unvbox \@outputbox
+       \ifnum\ltjgetparameter{direction}=4\else\hskip\z@\fi %%% LuaTeX-ja
+       \vskip -\dimen@
+       \@textbottom
+       }%
+   \fi
+   \global \maxdepth \@maxdepth
+}
+
 \endinput
-- 
cgit v1.2.3

