summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty
blob: 63ba23361753f71d03b1647847994a5b2efb02af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
%
% lltjcore.sty: derived from plcore.dtx in pLaTeX.
% This file does not include the code relating to "tategaki".
% 

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{lltjcore}[2015/01/01 Patch to LaTeX2e Kernel for LuaTeX-ja]

\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
\setlength{\@tombowwidth}{.1\p@}
\newbox\@TL\newbox\@Tl
\newbox\@TC
\newbox\@TR\newbox\@Tr
\newbox\@BL\newbox\@Bl
\newbox\@BC
\newbox\@BR\newbox\@Br
\newbox\@CL
\newbox\@CR
\font\@bannerfont=cmtt9
\newtoks\@bannertoken
\@bannertoken{}
\def\maketombowbox{%
  \setbox\@TL\hbox to\z@{\yoko\hss
      \vrule width13mm height\@tombowwidth depth\z@
      \vrule height10mm width\@tombowwidth depth\z@
      \iftombowdate
        \raise4pt\hbox to\z@{\hskip5mm\@bannerfont\the\@bannertoken\hss}%
      \fi}%
  \setbox\@Tl\hbox to\z@{\yoko\hss
      \vrule width10mm height\@tombowwidth depth\z@
      \vrule height13mm width\@tombowwidth depth\z@}%
  \setbox\@TC\hbox{\yoko
      \vrule width10mm height\@tombowwidth depth\z@
      \vrule height10mm width\@tombowwidth depth\z@
      \vrule width10mm height\@tombowwidth depth\z@}%
  \setbox\@TR\hbox to\z@{\yoko
      \vrule height10mm width\@tombowwidth depth\z@
      \vrule width13mm height\@tombowwidth depth\z@\hss}%
  \setbox\@Tr\hbox to\z@{\yoko
      \vrule height13mm width\@tombowwidth depth\z@
      \vrule width10mm height\@tombowwidth depth\z@\hss}%
  \setbox\@BL\hbox to\z@{\yoko\hss
      \vrule width13mm depth\@tombowwidth height\z@
      \vrule depth10mm width\@tombowwidth height\z@}%
  \setbox\@Bl\hbox to\z@{\yoko\hss
      \vrule width10mm depth\@tombowwidth height\z@
      \vrule depth13mm width\@tombowwidth height\z@}%
  \setbox\@BC\hbox{\yoko
      \vrule width10mm depth\@tombowwidth height\z@
      \vrule depth10mm width\@tombowwidth height\z@
      \vrule width10mm depth\@tombowwidth height\z@}%
  \setbox\@BR\hbox to\z@{\yoko
      \vrule depth10mm width\@tombowwidth height\z@
      \vrule width13mm depth\@tombowwidth height\z@\hss}%
  \setbox\@Br\hbox to\z@{\yoko
      \vrule depth13mm width\@tombowwidth height\z@
      \vrule width10mm depth\@tombowwidth height\z@\hss}%
  \setbox\@CL\hbox to\z@{\yoko\hss
      \vrule width10mm height.5\@tombowwidth depth.5\@tombowwidth
      \vrule height10mm depth10mm width\@tombowwidth}%
  \setbox\@CR\hbox to\z@{\yoko
      \vrule height10mm depth10mm width\@tombowwidth
      \vrule height.5\@tombowwidth depth.5\@tombowwidth width10mm\hss}%
}
\def\@outputtombow{%
  \iftombow
  \vbox to\z@{\kern-13mm\relax
    \moveleft3mm\vbox to\@@paperheight{%
      \hbox to\@@paperwidth{\hskip3mm\relax
         \copy\@TL\hfill\copy\@TC\hfill\copy\@TR\hskip3mm}%
      \kern-10mm
      \hbox to\@@paperwidth{\copy\@Tl\hfill\copy\@Tr}%
      \vfill
      \hbox to\@@paperwidth{\copy\@CL\hfill\copy\@CR}%
      \vfill
      \hbox to\@@paperwidth{\copy\@Bl\hfill\copy\@Br}%
      \kern-10mm
      \hbox to\@@paperwidth{\hskip3mm\relax
         \copy\@BL\hfill\copy\@BC\hfill\copy\@BR\hskip3mm}%
    }\vss
  }%
  \fi
}
\newdimen\@@paperheight
\newdimen\@@paperwidth
\newdimen\@@topmargin
\def\@outputpage{%
\begingroup % the \endgroup is put in by \aftergroup
  \ifnum\ltjgetparameter{direction}=4\else
    \dimen\z@\textwidth \textwidth\textheight \textheight\dimen\z@
  \fi
  \let \protect \noexpand
  \@resetactivechars
  \global\let\@@if@newlist\if@newlist
  \global\@newlistfalse
  \@parboxrestore
  \shipout\vbox{\yoko
    \set@typeset@protect
    \aftergroup\endgroup
    \aftergroup\set@typeset@protect
     \if@specialpage
       \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
     \fi
     \if@twoside
       \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
          \ifnum\ltjgetparameter{direction}=3 \let\@themargin\evensidemargin
          \else\let\@themargin\oddsidemargin\fi
       \else \let\@thehead\@evenhead
          \let\@thefoot\@evenfoot
           \ifnum\ltjgetparameter{direction}=3 \let\@themargin\oddsidemargin
           \else\let\@themargin\evensidemargin\fi
     \fi\fi
     \@@topmargin\topmargin
     \iftombow
       \@@paperwidth\paperwidth \advance\@@paperwidth 6mm\relax
       \@@paperheight\paperheight \advance\@@paperheight 16mm\relax
       \advance\@@topmargin 1in\relax \advance\@themargin 1in\relax
     \fi
     \reset@font
     \normalsize
     \normalsfcodes
     \let\label\@gobble
     \let\index\@gobble
     \let\glossary\@gobble
     \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
    \@begindvi
    \@outputtombow
    \vskip \@@topmargin
    \moveright\@themargin\vbox{%
      \setbox\@tempboxa \vbox to\headheight{%
        \vfil
        \color@hbox
          \normalcolor
          \hb@xt@\textwidth{\@thehead}%
        \color@endbox
      }%                        %% 22 Feb 87
      \dp\@tempboxa \z@
      \box\@tempboxa
      \vskip \headsep
      \box\@outputbox
      \baselineskip \footskip
      \color@hbox
        \normalcolor
        \hb@xt@\textwidth{\@thefoot}%
      \color@endbox
    }%
  }%
  \global\let\if@newlist\@@if@newlist
  \global \@colht \textheight
  \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
    \nfss@text{\reset@font\bfseries ??}%
    \@latex@warning{Reference `#3' on page \thepage \space
              undefined}%
  \else
    \expandafter#2#1\relax% change \null to \relax
  \fi}
\if@compatibility\else
\def\verb{\relax\ifmmode\hbox\else\leavevmode\fi
  \bgroup
    \verb@eol@error \let\do\@makeother \dospecials
    \verbatim@font\@noligs
    \@ifstar\@sverb\@verb}
\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