OSDN Git Service

lltjcore.sty: tentative fix for \@outputtombow (with multicol v1.8n)
[luatex-ja/luatexja.git] / src / patches / lltjcore.sty
1 %
2 % lltjcore.sty: derived from plcore.dtx in pLaTeX.
3 % This file does not include the code relating to "tategaki".
4
5
6 \NeedsTeXFormat{LaTeX2e}
7 \ProvidesPackage{lltjcore}[2016/04/01 Patch to LaTeX2e Kernel for LuaTeX-ja]
8
9 \def\cleardoublepage{\clearpage\if@twoside
10   \ifodd\c@page
11     \ifnum\ltjgetparameter{direction}=3
12       \hbox{}\thispagestyle{empty}\newpage
13       \if@twocolumn\hbox{}\newpage\fi
14     \fi
15   \else
16     \ifnum\ltjgetparameter{direction}=4
17       \hbox{}\thispagestyle{empty}\newpage
18       \if@twocolumn\hbox{}\newpage\fi
19     \fi
20   \fi\fi}
21 \newif\iftombow \tombowfalse
22 \newif\iftombowdate \tombowdatetrue
23 \newdimen\@tombowwidth
24 \setlength{\@tombowwidth}{.1\p@}
25 \newbox\@TL\newbox\@Tl
26 \newbox\@TC
27 \newbox\@TR\newbox\@Tr
28 \newbox\@BL\newbox\@Bl
29 \newbox\@BC
30 \newbox\@BR\newbox\@Br
31 \newbox\@CL
32 \newbox\@CR
33 \font\@bannerfont=cmtt9
34 \newtoks\@bannertoken
35 \@bannertoken{}
36 \def\maketombowbox{%
37   \setbox\@TL\hbox to\z@{\yoko\hss
38       \vrule width13mm height\@tombowwidth depth\z@
39       \vrule height10mm width\@tombowwidth depth\z@
40       \iftombowdate
41         \raise4pt\hbox to\z@{\hskip5mm\@bannerfont\the\@bannertoken\hss}%
42       \fi}%
43   \setbox\@Tl\hbox to\z@{\yoko\hss
44       \vrule width10mm height\@tombowwidth depth\z@
45       \vrule height13mm width\@tombowwidth depth\z@}%
46   \setbox\@TC\hbox{\yoko
47       \vrule width10mm height\@tombowwidth depth\z@
48       \vrule height10mm width\@tombowwidth depth\z@
49       \vrule width10mm height\@tombowwidth depth\z@}%
50   \setbox\@TR\hbox to\z@{\yoko
51       \vrule height10mm width\@tombowwidth depth\z@
52       \vrule width13mm height\@tombowwidth depth\z@\hss}%
53   \setbox\@Tr\hbox to\z@{\yoko
54       \vrule height13mm width\@tombowwidth depth\z@
55       \vrule width10mm height\@tombowwidth depth\z@\hss}%
56   \setbox\@BL\hbox to\z@{\yoko\hss
57       \vrule width13mm depth\@tombowwidth height\z@
58       \vrule depth10mm width\@tombowwidth height\z@}%
59   \setbox\@Bl\hbox to\z@{\yoko\hss
60       \vrule width10mm depth\@tombowwidth height\z@
61       \vrule depth13mm width\@tombowwidth height\z@}%
62   \setbox\@BC\hbox{\yoko
63       \vrule width10mm depth\@tombowwidth height\z@
64       \vrule depth10mm width\@tombowwidth height\z@
65       \vrule width10mm depth\@tombowwidth height\z@}%
66   \setbox\@BR\hbox to\z@{\yoko
67       \vrule depth10mm width\@tombowwidth height\z@
68       \vrule width13mm depth\@tombowwidth height\z@\hss}%
69   \setbox\@Br\hbox to\z@{\yoko
70       \vrule depth13mm width\@tombowwidth height\z@
71       \vrule width10mm depth\@tombowwidth height\z@\hss}%
72   \setbox\@CL\hbox to\z@{\yoko\hss
73       \vrule width10mm height.5\@tombowwidth depth.5\@tombowwidth
74       \vrule height10mm depth10mm width\@tombowwidth}%
75   \setbox\@CR\hbox to\z@{\yoko
76       \vrule height10mm depth10mm width\@tombowwidth
77       \vrule height.5\@tombowwidth depth.5\@tombowwidth width10mm\hss}%
78 }
79 \def\@outputtombow{%
80   \iftombow
81   \vbox to\z@{\kern-13mm\relax
82     \boxmaxdepth\maxdimen
83     \moveleft3mm\vbox to\@@paperheight{%
84       \hbox to\@@paperwidth{\hskip3mm\relax
85          \copy\@TL\hfill\copy\@TC\hfill\copy\@TR\hskip3mm}%
86       \kern-10mm
87       \hbox to\@@paperwidth{\copy\@Tl\hfill\copy\@Tr}%
88       \vfill
89       \hbox to\@@paperwidth{\copy\@CL\hfill\copy\@CR}%
90       \vfill
91       \hbox to\@@paperwidth{\copy\@Bl\hfill\copy\@Br}%
92       \kern-10mm
93       \hbox to\@@paperwidth{\hskip3mm\relax
94          \copy\@BL\hfill\copy\@BC\hfill\copy\@BR\hskip3mm}%
95     }\vss
96   }%
97   \fi
98 }
99 \newdimen\@@paperheight
100 \newdimen\@@paperwidth
101 \newdimen\@@topmargin
102 \def\@outputpage{%
103 \begingroup % the \endgroup is put in by \aftergroup
104   \ifnum\ltjgetparameter{direction}=4\else
105     \dimen\z@\textwidth \textwidth\textheight \textheight\dimen\z@
106   \fi
107   \let \protect \noexpand
108   \@resetactivechars
109   \global\let\@@if@newlist\if@newlist
110   \global\@newlistfalse
111   \@parboxrestore
112   \shipout\vbox{\yoko
113     \set@typeset@protect
114     \aftergroup\endgroup
115     \aftergroup\set@typeset@protect
116      \if@specialpage
117        \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
118      \fi
119      \if@twoside
120        \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
121           \ifnum\ltjgetparameter{direction}=3 \let\@themargin\evensidemargin
122           \else\let\@themargin\oddsidemargin\fi
123        \else \let\@thehead\@evenhead
124           \let\@thefoot\@evenfoot
125            \ifnum\ltjgetparameter{direction}=3 \let\@themargin\oddsidemargin
126            \else\let\@themargin\evensidemargin\fi
127      \fi\fi
128      \@@topmargin\topmargin
129      \iftombow
130        \@@paperwidth\paperwidth \advance\@@paperwidth 6mm\relax
131        \@@paperheight\paperheight \advance\@@paperheight 16mm\relax
132        \advance\@@topmargin 1in\relax \advance\@themargin 1in\relax
133      \fi
134      \reset@font
135      \normalsize
136      \normalsfcodes
137      \let\label\@gobble
138      \let\index\@gobble
139      \let\glossary\@gobble
140      \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
141     \@begindvi
142     \@outputtombow
143     \vskip \@@topmargin
144     \moveright\@themargin\vbox{%
145       \setbox\@tempboxa \vbox to\headheight{%
146         \vfil
147         \color@hbox
148           \normalcolor
149           \hb@xt@\textwidth{\@thehead}%
150         \color@endbox
151       }%                        %% 22 Feb 87
152       \dp\@tempboxa \z@
153       \box\@tempboxa
154       \vskip \headsep
155       \box\@outputbox
156       \baselineskip \footskip
157       \color@hbox
158         \normalcolor
159         \hb@xt@\textwidth{\@thefoot}%
160       \color@endbox
161     }%
162   }%
163   \global\let\if@newlist\@@if@newlist
164   \global \@colht \textheight
165   \stepcounter{page}%
166   \let\firstmark\botmark
167 }
168 \renewcommand\@makefnmark{\hbox{%
169   \unless\ifnum\ltjgetparameter{direction}=3
170     \@textsuperscript{\normalfont\@thefnmark}%
171   \else\hbox{\yoko \@textsuperscript{\normalfont\@thefnmark}}\fi}}
172 \long\def\@footnotetext#1{%
173   \ifcase\ltjgetparameter{direction}%
174     \or   \let\@tempa\dtou
175     \or\or\let\@tempa\tate
176     \or   \let\@tempa\yoko
177     \else \let\@tempa\utod
178   \fi
179   \insert\footins{\@tempa%
180     \reset@font\footnotesize
181     \interlinepenalty\interfootnotelinepenalty
182     \splittopskip\footnotesep
183     \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
184     \hsize\columnwidth \@parboxrestore
185     \protected@edef\@currentlabel{%
186        \csname p@footnote\endcsname\@thefnmark
187     }%
188     \color@begingroup
189       \@makefntext{%
190         \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
191     \color@endgroup}}
192 \def\@footnotemark{\leavevmode
193   \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
194   \unless\ifnum\ltjgetparameter{direction}=3 \@makefnmark
195   \else\hbox to\z@{\hskip-.25\zw\raise.9\zh\@makefnmark\hss}\fi
196   \ifhmode\spacefactor\@x@sf\fi\relax}
197 \begingroup
198 \@ifpackageloaded{hyperref}
199   {\def\ltj@setrefprefix{real}}
200   {\def\ltj@setrefprefix{}}
201 \expandafter\gdef\csname \ltj@setrefprefix @setref\endcsname#1#2#3{%
202   \ifx#1\relax
203     \protect\G@refundefinedtrue
204     \nfss@text{\reset@font\bfseries ??}%
205     \@latex@warning{Reference `#3' on page \thepage \space
206               undefined}%
207   \else
208     \expandafter#2#1\relax% change \null to \relax
209   \fi}
210 \endgroup
211 \if@compatibility\else
212 \def\verb{\relax\ifmmode\hbox\else\leavevmode\fi
213   \bgroup
214     \verb@eol@error \let\do\@makeother \dospecials
215     \verbatim@font\@noligs
216     \@ifstar\@sverb\@verb}
217 \fi
218 \gdef\@stopfield{\null\color@endgroup\egroup}
219 \newcount\hour
220 \newcount\minute
221
222 %%% AtBeginDvi
223 \def \AtBeginDvi #1{%
224   \global \setbox \@begindvibox
225     \vbox{\yoko\unvbox \@begindvibox #1}%
226 }
227
228 %%% @makecol
229 \gdef \@makecol {%
230    \ifvoid\footins
231      \setbox\@outputbox \box\@cclv
232    \else
233      \setbox\@outputbox \vbox {%
234        \boxmaxdepth \@maxdepth
235        \unvbox \@cclv
236        \vskip \skip\footins
237        \color@begingroup
238          \normalcolor
239          \footnoterule
240          \unvbox \footins
241        \color@endgroup
242        }%
243    \fi
244    \let\@elt\relax
245    \xdef\@freelist{\@freelist\@midlist}%
246    \global \let \@midlist \@empty
247    \@combinefloats
248    \ifvbox\@kludgeins
249      \@makespecialcolbox
250    \else
251      \setbox\@outputbox \vbox to\@colht {%
252        \@texttop
253        \dimen@ \dp\@outputbox
254        \unvbox \@outputbox
255        \ifnum\ltjgetparameter{direction}=4\else\hskip\z@\fi %%% LuaTeX-ja
256        \vskip -\dimen@
257        \@textbottom
258        }%
259    \fi
260    \global \maxdepth \@maxdepth
261 }
262
263 \endinput