OSDN Git Service

More LaTeX codes for vertical writing
[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}[2013/05/14 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     \moveleft3mm\vbox to\@@paperheight{%
83       \hbox to\@@paperwidth{\hskip3mm\relax
84          \copy\@TL\hfill\copy\@TC\hfill\copy\@TR\hskip3mm}%
85       \kern-10mm
86       \hbox to\@@paperwidth{\copy\@Tl\hfill\copy\@Tr}%
87       \vfill
88       \hbox to\@@paperwidth{\copy\@CL\hfill\copy\@CR}%
89       \vfill
90       \hbox to\@@paperwidth{\copy\@Bl\hfill\copy\@Br}%
91       \kern-10mm
92       \hbox to\@@paperwidth{\hskip3mm\relax
93          \copy\@BL\hfill\copy\@BC\hfill\copy\@BR\hskip3mm}%
94     }\vss
95   }%
96   \fi
97 }
98 \newdimen\@@paperheight
99 \newdimen\@@paperwidth
100 \newdimen\@@topmargin
101 \def\@outputpage{%
102 \begingroup % the \endgroup is put in by \aftergroup
103   \ifnum\ltjgetparameter{direction}=3 
104     \dimen\z@\textwidth \textwidth\textheight \textheight\dimen\z@
105   \fi
106   \let \protect \noexpand
107   \@resetactivechars
108   \global\let\@@if@newlist\if@newlist
109   \global\@newlistfalse
110   \@parboxrestore
111   \shipout\vbox{\yoko
112     \set@typeset@protect
113     \aftergroup\endgroup
114     \aftergroup\set@typeset@protect
115      \if@specialpage
116        \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
117      \fi
118      \if@twoside
119        \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
120           \ifnum\ltjgetparameter{direction}=3 \let\@themargin\evensidemargin
121           \else\let\@themargin\oddsidemargin\fi
122        \else \let\@thehead\@evenhead
123           \let\@thefoot\@evenfoot
124            \ifnum\ltjgetparameter{direction}=3 \let\@themargin\oddsidemargin
125            \else\let\@themargin\evensidemargin\fi
126      \fi\fi
127      \@@topmargin\topmargin
128      \iftombow
129        \@@paperwidth\paperwidth \advance\@@paperwidth 6mm\relax
130        \@@paperheight\paperheight \advance\@@paperheight 16mm\relax
131        \advance\@@topmargin 1in\relax \advance\@themargin 1in\relax
132      \fi
133      \reset@font
134      \normalsize
135      \normalsfcodes
136      \let\label\@gobble
137      \let\index\@gobble
138      \let\glossary\@gobble
139      \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
140     \@begindvi
141     \@outputtombow
142     \vskip \@@topmargin
143     \moveright\@themargin\vbox{%
144       \setbox\@tempboxa \vbox to\headheight{%
145         \vfil
146         \color@hbox
147           \normalcolor
148           \hb@xt@\textwidth{\@thehead}%
149         \color@endbox
150       }%                        %% 22 Feb 87
151       \dp\@tempboxa \z@
152       \box\@tempboxa
153       \vskip \headsep
154       \box\@outputbox
155       \baselineskip \footskip
156       \color@hbox
157         \normalcolor
158         \hb@xt@\textwidth{\@thefoot}%
159       \color@endbox
160     }%
161   }%
162   \global\let\if@newlist\@@if@newlist
163   \global \@colht \textheight
164   \stepcounter{page}%
165   \let\firstmark\botmark
166 }
167 \renewcommand\@makefnmark{\hbox{%
168   \unless\ifnum\ltjgetparameter{direction}=3
169     \@textsuperscript{\normalfont\@thefnmark}%
170   \else\hbox{\yoko \@textsuperscript{\normalfont\@thefnmark}}\fi}}
171 \long\def\@footnotetext#1{%
172   \ifcase\ltjgetparameter{direction}%
173     \or   \let\@tempa\dtou
174     \or\or\let\@tempa\tate
175     \or   \let\@tempa\yoko
176     \else \let\@tempa\utod
177   \fi
178   \insert\footins{\@tempa%
179     \reset@font\footnotesize
180     \interlinepenalty\interfootnotelinepenalty
181     \splittopskip\footnotesep
182     \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
183     \hsize\columnwidth \@parboxrestore
184     \protected@edef\@currentlabel{%
185        \csname p@footnote\endcsname\@thefnmark
186     }%
187     \color@begingroup
188       \@makefntext{%
189         \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
190     \color@endgroup}}
191 \def\@footnotemark{\leavevmode
192   \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
193   \unless\ifnum\ltjgetparameter{direction}=3 \@makefnmark
194   \else\hbox to\z@{\hskip-.25\zw\raise.9\zh\@makefnmark\hss}\fi
195   \ifhmode\spacefactor\@x@sf\fi\relax}
196 \def\@setref#1#2#3{%
197   \ifx#1\relax
198     \protect\G@refundefinedtrue
199     \nfss@text{\reset@font\bfseries ??}%
200     \@latex@warning{Reference `#3' on page \thepage \space
201               undefined}%
202   \else
203     \expandafter#2#1\relax% change \null to \relax
204   \fi}
205 \if@compatibility\else
206 \def\verb{\relax\ifmmode\hbox\else\leavevmode\fi
207   \bgroup
208     \verb@eol@error \let\do\@makeother \dospecials
209     \verbatim@font\@noligs
210     \@ifstar\@sverb\@verb}
211 \fi
212 \gdef\@stopfield{\null\color@endgroup\egroup}
213 \newcount\hour
214 \newcount\minute
215
216 \endinput