OSDN Git Service

lltjcore.sty: tentative fix for \@outputtombow (with multicol v1.8n)
[luatex-ja/luatexja.git] / src / patches / lltjcore.sty
index 3dbcc41..2b301d8 100644 (file)
@@ -4,9 +4,20 @@
 % 
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjcore}[2011/11/22 Patch to LaTeX2e Kernel for LuaLaTeX-ja]
+\ProvidesPackage{lltjcore}[2016/04/01 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
@@ -68,6 +79,7 @@
 \def\@outputtombow{%
   \iftombow
   \vbox to\z@{\kern-13mm\relax
+    \boxmaxdepth\maxdimen
     \moveleft3mm\vbox to\@@paperheight{%
       \hbox to\@@paperwidth{\hskip3mm\relax
          \copy\@TL\hfill\copy\@TC\hfill\copy\@TR\hskip3mm}%
 \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
      \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
   \stepcounter{page}%
   \let\firstmark\botmark
 }
-
-\def\@setref#1#2#3{%
+\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}
+\begingroup
+\@ifpackageloaded{hyperref}
+  {\def\ltj@setrefprefix{real}}
+  {\def\ltj@setrefprefix{}}
+\expandafter\gdef\csname \ltj@setrefprefix @setref\endcsname#1#2#3{%
   \ifx#1\relax
     \protect\G@refundefinedtrue
     \nfss@text{\reset@font\bfseries ??}%
   \else
     \expandafter#2#1\relax% change \null to \relax
   \fi}
+\endgroup
 \if@compatibility\else
 \def\verb{\relax\ifmmode\hbox\else\leavevmode\fi
   \bgroup
 \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