aozora4reader 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,481 @@
1
+ \NeedsTeXFormat{pLaTeX2e}
2
+ \ProvidesPackage{aozora4reader}[2009/02/05 v0.5 takayama, 2010/12/28 v0.2 takahashim]
3
+ \RequirePackage{verbatim}
4
+ \RequirePackage{keyval}
5
+ %
6
+ %スタイルオプション
7
+ %
8
+ \newif\if@waku \@wakutrue
9
+ \def\aozora@title@style{plain}
10
+ \def\aozora@dviware{dvipdfm}
11
+ \def\device@type{sonyreader}
12
+ \def\base@size{normal}
13
+ \define@key{aozora}{title}[plain]{\def\aozora@title@style{#1}}
14
+ \define@key{aozora}{device}[sonyreader]{\def\device@type{#1}}
15
+ \define@key{aozora}{size}[normal]{\def\base@size{#1}}
16
+ \define@key{aozora}{dviware}[dvipdfm]{\def\aozora@dviware{#1}}
17
+ \define@key{aozora}{final}[true]{\let\footnote\@gobble}
18
+ \define@key{aozora}{draft}[false]{\relax}
19
+ \define@key{aozora}{nowaku}[false]{\@wakufalse}
20
+ \def\ProcessOptionsWithKV#1{%
21
+ \let\@tempc\relax%
22
+ \let\aozora@tempa\@empty
23
+ \@for\CurrentOption:=\@classoptionslist\do{%
24
+ \@ifundefined{KV@#1@\CurrentOption}%
25
+ {}%
26
+ {\edef\aozora@tempa{\aozora@tempa,\CurrentOption,}}%
27
+ }%
28
+ \edef\aozora@tempa{%
29
+ \noexpand\setkeys{#1}{%
30
+ \aozora@tempa\@ptionlist{\@currname.\@currext}%
31
+ }%
32
+ }%
33
+ \aozora@tempa
34
+ }
35
+ \ProcessOptionsWithKV{aozora}
36
+ \AtEndOfPackage{%
37
+ \let\@unprocessedoptions\relax
38
+ }
39
+ %graphic packageの読み込み
40
+ \RequirePackage[\aozora@dviware]{graphicx}
41
+ %新しい単位の設定
42
+ \newlength{\JQ}
43
+ \setlength{\JQ}{0.259817mm}
44
+ %
45
+ %用紙サイズおよび文字サイズの設定
46
+ %
47
+ \def\device@a{sonyreader}
48
+ \def\device@b{xxxxxxxx}
49
+ \def\size@a{normal}
50
+ \def\size@b{small}
51
+ \def\size@c{large}
52
+ \newdimen\nmls
53
+ \newdimen\nmlbs
54
+ \newdimen\smls
55
+ \newdimen\smlbs
56
+ \newdimen\ftns
57
+ \newdimen\ftnbs
58
+ \newdimen\scrs
59
+ \newdimen\scrbs
60
+ \newdimen\hugs
61
+ \newdimen\hugbs
62
+ \newdimen\huges
63
+ \newdimen\hugebs
64
+ \newcount\nmlqn
65
+ \newcount\jisuu
66
+ \newcount\gyousuu
67
+ %文字サイズの決定
68
+ \ifx\base@size\size@a
69
+ %通常の大きさの定義
70
+ \nmlqn=13 %\normalsizeの級数
71
+ \nmlbs=22H %\normalsizeの行送り
72
+ \smls =11\JQ%\smallの大きさ
73
+ \smlbs=18H %\smallの行送り
74
+ \ftns =10\JQ%\footnotesizeの大きさ
75
+ \ftnbs=15H %\footnotesizeの行送り
76
+ \scrs = 9\JQ%\scriptsizeの級数
77
+ \scrbs=12H %\scriptsizeの行送り
78
+ \else
79
+ \ifx\base@size\size@b
80
+ %小さい場合の定義
81
+ \nmlqn=11 %\normalsizeの級数
82
+ \nmlbs=19H %\normalsizeの行送り
83
+ \smls =10\JQ%\smallの大きさ
84
+ \smlbs=18H %\smallの行送り
85
+ \ftns = 9\JQ%\footnotesizeの大きさ
86
+ \ftnbs=15H %\footnotesizeの行送り
87
+ \scrs = 8\JQ%\scriptsizeの級数
88
+ \scrbs=12H %\scriptsizeの行送り
89
+ \else
90
+ \ifx\base@size\size@c
91
+ %大きい場合の定義
92
+ \nmlqn=15 %\normalsizeの級数
93
+ %% \nmlqn=14 %\normalsizeの級数
94
+ %% \nmlbs=26H %\normalsizeの行送り ←これだとルビやfootnoteが入ったときに厳しいっぽい
95
+ \nmlbs=25H %\normalsizeの行送り
96
+ \smls =12\JQ%\smallの大きさ
97
+ \smlbs=21H %\smallの行送り
98
+ \ftns =11\JQ%\footnotesizeの大きさ
99
+ \ftnbs=16H %\footnotesizeの行送り
100
+ \scrs =10\JQ%\scriptsizeの級数
101
+ \scrbs=14H %\scriptsizeの行送り
102
+ \else
103
+ \PackageError{aozora4reader}{Unkown letter size.}{Choose 'normal' or 'small' or 'large'.}
104
+ \fi
105
+ \fi
106
+ \fi
107
+ \nmls =\nmlqn\JQ%normalsizeの級数
108
+ \hugs =25\JQ%\hugeの大きさ
109
+ \hugbs=40H %\hugeの行送り
110
+ \huges=\smls
111
+ \multiply\huges by 3 %\Hugeは\smallの3倍
112
+ \hugebs=\smlbs
113
+ \multiply\hugebs by 3 %\Hugeの行送り
114
+ %用紙サイズの決定
115
+ \ifx\device@type\device@a
116
+ %SonyReader用の設定
117
+ %%\setlength\paperwidth{340H}
118
+ \setlength\paperwidth{350H}
119
+ %%\setlength\paperheight{453H}
120
+ \setlength\paperheight{466H}
121
+ \ifx\base@size\size@a
122
+ %通常の大きさの場合
123
+ \jisuu=31 \gyousuu=15
124
+ \else
125
+ \ifx\base@size\size@b
126
+ %小さい場合の場合
127
+ \jisuu=37 \gyousuu=17
128
+ \else
129
+ \ifx\base@size\size@c
130
+ %大きい場合の場合
131
+ %% \jisuu=27 \gyousuu=13
132
+ \jisuu=28 \gyousuu=13
133
+ \else
134
+ \PackageError{aozora4reader}{Unkown letter size.}{Choose 'normal' or 'small' or 'large'.}
135
+ \fi
136
+ \fi
137
+ \fi
138
+ \else
139
+ \ifx\device@type\device@b
140
+ %xxxxxxxx用の設定
141
+ \setlength\paperwidth{530H}
142
+ \setlength\paperheight{771H}
143
+ \@twocolumntrue
144
+ \ifx\base@size\size@a
145
+ %通常の大きさの場合
146
+ \jisuu=55 \gyousuu=23
147
+ \else
148
+ \ifx\base@size\size@b
149
+ %小さい場合の場合
150
+ \jisuu=65 \gyousuu=26
151
+ \else
152
+ \ifx\base@size\size@c
153
+ %大きい場合の場合
154
+ \jisuu=48 \gyousuu=20
155
+ \else
156
+ \PackageError{aozora4reader}{Unkown letter size.}{Choose 'normal' or 'small' or 'large'.}
157
+ \fi
158
+ \fi
159
+ \fi
160
+ \else
161
+ \PackageError{aozora4reader}{Unkown device.}{Choose 'sonyreader' or 'xxxxxxxx'.}
162
+ \fi
163
+ \fi
164
+ %
165
+ %文字サイズの定義
166
+ %
167
+ \renewcommand{\normalsize}{%
168
+ \@setfontsize\normalsize{\nmls}{\nmlbs}%
169
+ \abovedisplayskip\z@ \belowdisplayskip\z@
170
+ \abovedisplayshortskip\z@ \belowdisplayshortskip\z@
171
+ \let\@listi\@listI}
172
+ \normalsize
173
+ \setlength\Cht{0.5zh}
174
+ \setlength\Cdp{0.5zh}
175
+ \setlength\Cwd{1zw}
176
+ \setlength\Cvs{\baselineskip}
177
+ \setlength\Chs{1zh}
178
+ \renewcommand{\small}{%
179
+ \@setfontsize\small{\smls}{\smlbs}%
180
+ \abovedisplayskip\z@ \belowdisplayskip\z@
181
+ \abovedisplayshortskip\z@ \belowdisplayshortskip\z@
182
+ \let\@listi\@listI}
183
+ \renewcommand{\footnotesize}{%
184
+ \@setfontsize\footnotesize{\ftns}{\ftnbs}%
185
+ \abovedisplayskip\z@ \belowdisplayskip\z@
186
+ \abovedisplayshortskip\z@ \belowdisplayshortskip\z@
187
+ \let\@listi\@listI}
188
+ \renewcommand{\scriptsize}{\@setfontsize\scriptsize{\scrs}{\scrbs}}
189
+ \renewcommand{\tiny}{\@setfontsize\tiny{0.5\nmls}{0.5\nmlbs}}
190
+ \newcommand{\TINY}{\@setfontsize\TINY{0.25\nmls}{0.25\nmlbs}}
191
+ \renewcommand{\huge}{\@setfontsize\huge{\hugs}{\hugbs}}
192
+ \renewcommand{\Huge}{\@setfontsize\Huge{\huges}{\hugebs}}
193
+ %
194
+ %版面の設定
195
+ %
196
+ \setlength\columnseprule{0pt}
197
+ \setlength\marginparsep{0pt}
198
+ \setlength\marginparwidth{0pt}
199
+ \setlength{\footskip}{0H}%フッタは使わないので0とする。
200
+ \setlength\columnsep{3zw}%段間3文字分
201
+ \textwidth=\nmlqn H
202
+ \multiply \textwidth by \jisuu
203
+ \advance\gyousuu by -1
204
+ \textheight=\baselineskip
205
+ \multiply \textheight by \gyousuu
206
+ \advance \textheight by \nmlqn H
207
+ \setlength\topskip{\Cht}
208
+ \setlength\topmargin{-1in}
209
+ %左右の空き(版面が左右中央に来るように設定)
210
+ \dimen0=\paperwidth
211
+ \advance\dimen0 by -\textheight
212
+ \oddsidemargin=.5\dimen0
213
+ \advance\oddsidemargin by -1in
214
+ \evensidemargin=\oddsidemargin
215
+ %余白を調整
216
+ \addtolength\topmargin{2mm}%用紙上端とヘッダ上端の間隔
217
+ %%\setlength\headheight{8H}%ヘッダの高さ
218
+ \setlength\headheight{10H}%ヘッダの高さ
219
+ %%\setlength\headsep{15H}%ヘッダの下端と本文の上端の間隔
220
+ \setlength\headsep{13H}%ヘッダの下端と本文の上端の間隔
221
+ %共通の設定
222
+ \kanjiskip=0pt plus .0625zw minus .0625zw%和字間は最大16分まで延び、最大16分縮む
223
+ \xkanjiskip=.25zw plus .083zw minus .125zw%和欧文間は最大3分まで延び、最大8分まで縮む
224
+ \maxdepth=\topskip
225
+ %段落の設定
226
+ \setlength\parskip{0pt}
227
+ \setlength\parsep{0pt}
228
+ \setlength\partopsep{0pt}
229
+ \setlength\parindent{0pt}
230
+ \raggedbottom
231
+ \AtBeginDocument{\obeylines}
232
+ %
233
+ %行整形用パラメータ
234
+ %
235
+ \clubpenalty=0
236
+ \widowpenalty=0
237
+ \jcharwidowpenalty=0
238
+ \displaywidowpenalty=0
239
+ \prebreakpenalty\jis"2147=10000 % 5000 ’
240
+ \postbreakpenalty\jis"2148=10000 % 5000 “
241
+ \prebreakpenalty\jis"2149=10000 % 5000 ”
242
+ \inhibitxspcode`〒=2
243
+ \prebreakpenalty\jis"2133=10000
244
+ \prebreakpenalty\jis"2134=10000
245
+ \prebreakpenalty\jis"2135=10000
246
+ \prebreakpenalty\jis"2136=10000
247
+ %
248
+ %fontの設定
249
+ %
250
+ \def\headfont{\mcfamily\sffamily}%\section, \subsetionの見出し
251
+ \def\titlefont{\mcfamily\bfseries}%題名のフォント
252
+ \def\subtitlefont{\mcfamily}%副題のフォント
253
+ \def\authorfont{\mcfamily}%著者のフォント
254
+ %
255
+ %タイトル部分
256
+ %
257
+ \def\metadata#1{\relax}
258
+ \def\subtitle#1{\gdef\@subtitle{#1}}
259
+ \def\subauthor#1{\gdef\@subauthor{#1}}
260
+ \def\biblioname{青空文庫}
261
+ \def\azbanner{\hbox{\yoko\includegraphics[height= 1.5cm]{azlogo.eps}}\hspace*{50Q}}
262
+ \renewcommand{\maketitle}{
263
+ \cleardoublepage
264
+ \if@twocolumn
265
+ \@restonecoltrue\onecolumn
266
+ \else
267
+ \@restonecolfalse\newpage
268
+ \fi
269
+ \thispagestyle{empty}
270
+ \setcounter{page}\@ne
271
+ \begingroup
272
+ \let\footnotesize\small
273
+ \let\footnoterule\relax
274
+ \let\thanks\p@thanks
275
+ \let\footnote\thanks
276
+ \@ifundefined{\aozora@title@style @a5}
277
+ {\plain@a5}%
278
+ {\expandafter\csname\aozora@title@style @a5\endcsname}
279
+ \endgroup
280
+ \clearpage
281
+ \thispagestyle{empty}
282
+ \az@title@back
283
+ \if@restonecol\twocolumn \else \newpage \fi
284
+ \clearpage
285
+ \setcounter{footnote}{0}%
286
+ \global\let\thanks\relax
287
+ \global\let\p@thanks\relax
288
+ \global\let\@thanks\@empty
289
+ \global\let\@author\@empty
290
+ \global\let\@date\@empty
291
+ \global\let\date\relax
292
+ \global\let\and\relax
293
+ }%
294
+ \def\az@title@back{%タイトルの裏
295
+ \vbox to\textheight{\vss%
296
+ \hbox to\textwidth{\tate\hfill\azbanner}
297
+ \vss
298
+ }%
299
+ }
300
+ %
301
+ %デフォルトのタイトルページ
302
+ %
303
+ \@namedef{plain@a5}{\begingroup
304
+ \def\rubykatuji{\rubyfamily\small}
305
+ \vbox to\textheight\bgroup\tate\hsize\textwidth
306
+ \null\vfil
307
+ \begin{center}%
308
+ {\fontsize{40pt}{40pt}\selectfont\titlefont \@title \par}%
309
+ \@ifundefined{@subtitle}{\relax}{{\vskip 0.5em\huge\subtitlefont \@subtitle \par}}
310
+ \vskip 1.5em%
311
+ {\Huge
312
+ \lineskip .5em%
313
+ \begin{tabular}[t]{c}%
314
+ \authorfont\@author
315
+ \@ifundefined{@subauthor}{\relax}{\\\authorfont\@subauthor}
316
+ \end{tabular}\par}%
317
+ \end{center}\par
318
+ \vfil\null
319
+ \egroup
320
+ \endgroup
321
+ }
322
+ \def\cleardoublepage{\clearpage
323
+ \ifodd\c@page
324
+ \else
325
+ \hbox{}\thispagestyle{empty}\newpage
326
+ \if@twocolumn\hbox{}\newpage\fi
327
+ \fi
328
+ }
329
+ % マクロなど
330
+ \def\ruby{\kana}
331
+ \def\Ruby#1#2{\kana[2]{#1}{#2}}
332
+ \def\RUBY#1#2{\kana[3]{#1}{#2}}
333
+ \let\KANA=\KANAtop
334
+ \def\――{―\kern-.5zw―\kern-.5zw―}
335
+ \newenvironment{jisage}[1]{\advance\leftskip#1zw}{}
336
+ \def\sirogomabou#1{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny\ajWhiteSesame}}\bou{#1}\egroup}
337
+ \def\marubou#1{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny●}}\bou{#1}\egroup}
338
+ \def\siromarubou#1{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny○}}\bou{#1}\egroup}
339
+ \def\kurosankakubou#1{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny▲}}\bou{#1}\egroup}
340
+ \def\sirosankakubou#1{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny△}}\bou{#1}\egroup}
341
+ \def\nijyuumarubou#1{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny◎}}\bou{#1}\egroup}
342
+ \def\jyanomebou#1{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny\UTF{25C9}}}\bou{#1}\egroup}
343
+ \def\ajKunojiwithsirogomaBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny\ajWhiteSesame}}\ajKunojiwithBou\egroup}
344
+ \def\ajKunojiwithmaruBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny●}}\ajKunojiwithBou\egroup}
345
+ \def\ajKunojiwithsiromaruBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny○}}\ajKunojiwithBou\egroup}
346
+ \def\ajKunojiwithkurosankakuBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny▲}}\ajKunojiwithBou\egroup}
347
+ \def\ajKunojiwithsirosankakuBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny△}}\ajKunojiwithBou\egroup}
348
+ \def\ajKunojiwithnijyuumaruBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny◎}}\ajKunojiwithBou\egroup}
349
+ \def\ajKunojiwithjyanomeBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny\UTF{25C9}}}\ajKunojiwithBou\egroup}
350
+ \def\ajDKunojiwithsirogomaBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny\ajWhiteSesame}}\ajDKunojiwithBou\egroup}
351
+ \def\ajDKunojiwithmaruBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny●}}\ajDKunojiwithBou\egroup}
352
+ \def\ajDKunojiwithsiromaruBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny○}}\ajDKunojiwithBou\egroup}
353
+ \def\ajDKunojiwithkurosankakuBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny▲}}\ajDKunojiwithBou\egroup}
354
+ \def\ajDKunojiwithsirosankakuBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny△}}\ajDKunojiwithBou\egroup}
355
+ \def\ajDKunojiwithnijyuumaruBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny◎}}\ajDKunojiwithBou\egroup}
356
+ \def\ajDKunojiwithjyanomeBou{\bgroup\renewcommand{\boutenchar}{\hbox to 1zh{\tate\hfil\tiny\UTF{25C9}}}\ajDKunojiwithBou\egroup}
357
+ \def\kaeriten#1{%
358
+ \nobreak\setbox1\hbox{あ}\setbox2\hbox{\tiny あ}
359
+ \ifdim\ht1=\ht2
360
+ \setbox1\hbox{あ}\setbox2\hbox{\TINY あ}
361
+ \dimen1=\ht1 \advance\dimen1 by -\ht2
362
+ \raisebox{-\dimen1}{\TINY #1}%
363
+ \else
364
+ \dimen1=\ht1 \advance\dimen1 by -\ht2
365
+ \raisebox{-\dimen1}{\tiny #1}%
366
+ \fi
367
+ }%
368
+ \def\okurigana#1{%
369
+ \nobreak\setbox1\hbox{あ}\setbox2\hbox{\tiny あ}
370
+ \ifdim\ht1=\ht2
371
+ \setbox1\hbox{あ}\setbox2\hbox{\TINY あ}
372
+ \dimen1=\ht1 \advance\dimen1 by -\ht2
373
+ \raisebox{\dimen1}{\TINY #1}%
374
+ \else
375
+ \dimen1=\ht1 \advance\dimen1 by -\ht2
376
+ \raisebox{\dimen1}{\tiny #1}%
377
+ \fi
378
+ }%
379
+ \def\sashie#1{%
380
+ \hbox{\yoko\includegraphics[keepaspectratio=true, width = 8cm]{#1}}
381
+ }%
382
+ \def\bousen#1{#1}
383
+ \AtBeginDvi{\special{pdf: pagesize height \the\paperheight\space width \the\paperwidth}}
384
+ \AtBeginDvi{\special{pdf:docview <</ViewerPreferences <</Direction /R2L>> >>}}
385
+ \def\thefootnote{\@arabic\c@footnote}
386
+ %
387
+ %脚注の定義
388
+ %
389
+ \def\@footnotemark{%
390
+ \leavevmode
391
+ \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
392
+ \@makefnmark
393
+ \ifhmode\spacefactor\@x@sf\fi
394
+ \relax}
395
+ \def\@makefnmark{\raise0.25zh\hbox to 0.5zw{\hss\normalfont\tiny\rensuji{\@thefnmark}\hss}}
396
+ %
397
+ %後註の定義
398
+ %
399
+ \newcounter{notecount}
400
+ \setcounter{notecount}{0}
401
+ \def\thenotecount{\@arabic\c@notecount}
402
+ \def\endnote#1{%
403
+ \stepcounter{notecount}%
404
+ \raisebox{0.25zh}{\tiny\kanji\c@notecount}%
405
+ \expandafter\gdef\csname note@\number\c@notecount\endcsname{#1}%
406
+ }
407
+ \def\endnotehead{後註}
408
+ \def\theendnotes{%
409
+ \@ifundefined{note@1}{\relax}{%
410
+ {\headfont\normalsize\noindent\endnotehead\par}%
411
+ \@tempcnta=\thenotecount\relax%
412
+ \advance\@tempcnta by1\relax%
413
+ \setcounter{notecount}{0}%
414
+ \begin{description}
415
+ \footnotesize
416
+ \loop
417
+ \stepcounter{notecount}
418
+ \ifnum\@tempcnta>\c@notecount
419
+ \item[\kanji\c@notecount]\csname note@\number\c@notecount\endcsname\par
420
+ \global\expandafter\let\csname note@\number\c@notecount\endcsname=\@undefined%
421
+ \repeat
422
+ \end{description}
423
+ }%
424
+ \setcounter{notecount}{0}%
425
+ }
426
+ %
427
+ %ヘッダの定義
428
+ %
429
+ \def\ps@aozora{\let\ps@jpl@in\ps@headnombre
430
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
431
+ \def\@oddhead{\scriptsize\null
432
+ \hspace*{\nmls}\@ifundefined{@title}{\relax}{\@title}%
433
+ \hspace*{1zw}\@ifundefined{@subtitle}{\relax}{\@subtitle}%
434
+ \hfil}
435
+ \let\@evenhead\@oddhead
436
+ \let\@mkboth\markboth
437
+ }
438
+ \pagestyle{aozora}
439
+ %
440
+ %底本の処理の変更(ダミー環境)
441
+ %
442
+ \newenvironment{teihon}{\relax}{\relax}
443
+ %
444
+ %紙面の上下に紙幅の線を引く
445
+ %
446
+ \newdimen\waku@line@width
447
+ \setlength{\waku@line@width}{.1\p@}
448
+ \newdimen\waku@top@shift
449
+ \setlength{\waku@top@shift}{-1in}
450
+ \newdimen\waku@left@shift
451
+ \setlength{\waku@left@shift}{1in}
452
+ \newbox\@WTC
453
+ \newbox\@WBC
454
+ \def\makewakubox{%
455
+ \setbox\@WTC\hbox to\z@{\yoko\hss
456
+ \vrule width \paperwidth height\z@ depth\waku@line@width\hss}%
457
+ \setbox\@WBC\hbox to\z@{\yoko\hss
458
+ \vrule width \paperwidth depth\z@ height\waku@line@width\hss}%
459
+ }
460
+ \let\orig@outputtombow\@outputtombow
461
+ \def\@outputtombow{%
462
+ \iftombow
463
+ \orig@outputtombow
464
+ \else
465
+ \if@waku
466
+ \moveleft\waku@left@shift\vbox to\z@{\kern\waku@top@shift\relax
467
+ \vbox to\paperheight{%
468
+ \hbox to\paperwidth{\hss\copy\@WTC\hss}%
469
+ \vss
470
+ \hbox to\paperwidth{\hss\copy\@WBC\hss}%
471
+ }\vss
472
+ }%
473
+ \fi
474
+ \fi
475
+ }
476
+ \if@waku
477
+ \setlength{\waku@line@width}{.1\p@}%
478
+ \makewakubox%
479
+ \fi
480
+ \endinput
481
+ %based on aozora.sty by psitau