-
Notifications
You must be signed in to change notification settings - Fork 0
/
gwgz.tex
221 lines (192 loc) · 6.13 KB
/
gwgz.tex
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
\documentclass[openany,a5paper]{utbook}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
%% CTeX headings
\usepackage[fontset=custom, heading=true]{ctex}
\usepackage{zhnumber}
\ctexset{
chapter = {
name = {古文觀止卷} ,
number = \zhnum{chapter} ,
% numbering = false,
format = \huge\bfseries ,
nameformat = {} ,
titleformat = {} ,
aftername = \quad ,
beforeskip = 0 pt ,
afterskip = 20 pt ,
afterindent = true ,
pagestyle = main ,
} ,
section = {
numbering = false ,
format = \Large\bfseries,
indent = 42 pt ,
afterindent = true ,
}
}
%% draft watermark
\usepackage[colorspec=0.9]{draftwatermark}
\SetWatermarkText{未 經 審 定}
\SetWatermarkScale{0.5}
%% ToC
\usepackage[titles]{tocloft}
\usepackage{everypage}
\usepackage{calc}
\makeatletter
\AddEverypageHook{\if@mainmatter\addtocontents{toc}{
\protect\cftsetpnumwidth{\widthof{\thepage} * \real{0.5}}
}
\fi}
\makeatother
\renewcommand{\cftchapfont}{\bfseries}
\renewcommand{\cftchappagefont}{\small}
\renewcommand{\cftsecpagefont}{\small}
%% ToC: scale page no.
\usepackage{xstring}
\newcommand{\scalepagenum}[1]{\StrLeft{\detokenize{#1}}{1}[\firsttoken]\ifcat 一\firsttoken\scalebox{0.5}[1]{#1}\else #1\fi}
\makeatletter
\renewcommand{\cftchapfillnum}[1]{%
{\cftchapleader}\nobreak
\pbox<t>[\@pnumwidth][\cftpnumalign]{{\cftchappagefont\scalepagenum{#1}}}\cftchapafterpnum\par
}
\renewcommand{\cftsecfillnum}[1]{%
{\cftsecleader}\nobreak
\pbox<t>[\@pnumwidth][\cftpnumalign]{{\cftchappagefont\scalepagenum{#1}}}\cftsecafterpnum\par
}
\makeatother
\renewcommand{\contentsname}{古文觀止目錄}
%% page style
\zhnumsetup{style=Traditional}
\usepackage{titleps}
\newcommand\frontchaptertitle{}
\makeatletter
\def\mainchapterheader{
\if@mainmatter
\raisebox{\dimexpr-\height-\headsep\relax}[0pt]{%
\hbox to \textheight{%
\tate\hspace{3zh}\small
\ifnum\value{chapter} > \z@
\CTEXthechapter\quad\chaptertitle
\else
\frontchaptertitle
\fi\hfill
\scalebox{0.5}[1]{\thepage}\hspace{4zh}}}%
\else
\raisebox{\dimexpr-\height-\headsep\relax}[0pt]{%
\hbox to \textheight{%
\tate\hspace{3zh}\small\chaptertitle\hfill
\thepage\hspace{4zh}}}%
\fi
}
\newpagestyle{main}{%
\widenhead{30pt}{30pt}%
\sethead[][][{\mainchapterheader}]{\mainchapterheader}{}{}
}
\makeatother
\pagestyle{main}
\addtolength{\textwidth}{\footskip}
%% underlines
\usepackage[normalem]{ulem}
\newcommand\ProperName[1]{\hskip.1zw\uline{\kern-.1zw#1\kern-.1zw}\kern.1zw}
% \newcommand\PlaceName[1]{\def\tempdepth{\the\ULdepth}\setlength{\ULdepth}{.75zw}\hskip.1zw\uuline{\kern-.1zw#1\kern-.1zw}\kern.1zw\setlength{\ULdepth}{\tempdepth}}
\newcommand\smallwave{\bgroup \markoverwith{\lower0.9zh\hbox{$\tilde{\null\kern0.25zw}$}}\ULon}
\newcommand\BookTitle[1]{\hskip.15zw\smallwave{\kern-.1zw#1\kern-.1zw}\kern.1zw}
%% critical apparatus
\usepackage{endnotes}
\newlength{\moziretuhaba}
\newlength{\moziretutakasa}
\newlength{\mozireturaise}
\newlength{\moziretuskip}
\def\makenotenumbermark#1{\settowidth{\moziretuhaba}{{\scriptsize #1}}%
\addtolength{\moziretuhaba}{2pt}%
\settoheight{\moziretutakasa}{{\scriptsize #1}}%
\setlength{\mozireturaise}{\dimexpr(0.2zw+\moziretutakasa)\relax}%
\setlength{\moziretuskip}{\dimexpr(1pt)\relax}%
\unskip%
\hskip\kanjiskip%
\parbox[b]{\moziretuhaba}{\hskip\moziretuskip\raisebox{\mozireturaise}{\scriptsize #1}}
\unskip%
}
\renewcommand{\makeenmark}{\makenotenumbermark{\scalebox{0.5}[1]{{[\normalfont\zhdigits{\theenmark}]}}}}
\renewcommand{\enotesize}{\small}
\renewcommand\enoteheading{
\vskip1.5zh % \hrule width 0.3\textwidth height 0.5pt\vskip1em
% \fbox{\textbf{校勘記}}
% \vskip1em\nopagebreak[4]
}
\makeatletter
\def\enoteformat{%
\scalebox{0.5}[1]{{[\normalfont\zhdigits{\theenmark}]}}\enskip
}
\makeatother
\usepackage{etoolbox}
\pretocmd{\chapter}{\setcounter{endnote}{0}}{}{}
\pretocmd{\section}{\setcounter{endnote}{0}}{}{}
\makeatletter
\@addtoreset{endnote}{chapter}
\@addtoreset{endnote}{section}
\makeatother
%% misc
\setlength\parindent{2zw}
\usepackage{multicol}
\usepackage{relsize}
\usepackage{datetime}
%% fonts
\usepackage[dvipdfmx, bookmarksnumbered]{hyperref}
\DeclareKanjiFamily{JT2}{songext}{}
\DeclareFontShape{JT2}{songext}{m}{n}{<->uptchrm-v}{}
\AtBeginShipoutFirst{%
\special{pdf:mapline uptchrm-v unicode rIMing.ttf -w 1}
}
\begin{document}
%% Cover
\pagenumbering{gobble}
\thispagestyle{empty}
~\vfill{\it{\Large\parbox{1zw}{校栞}}\quad\Huge 古 文 觀 止\quad{\normalsize 徵 求 意 見 稿}\par}\vfill
\newpage\thispagestyle{empty}
\begin{minipage}<y>[htpb]{85mm}
\vspace{12cm}
{\parskip=5pt \tiny The source and scripts used to compose this document are available at \url{https://github.com/mondain-dev/gwgz}.
The text in this document is typeset in rIMing font (nightly build) based on IPA mj Mincho. More info available at \url{https://github.com/mondain-dev/rIMing}.
This version was compiled on \today.\par
}
\end{minipage}
%% ToC
\frontmatter
% \renewcommand\thepage{\rensuji{\arabic{page}}\relax}
\phantomsection
\renewcommand\thepage{\rensuji{\roman{page}}\relax}
\begin{multicols}{2}
\addcontentsline{toc}{chapter}{目錄}
\tableofcontents
\end{multicols}
\chapter{凡例}
\input{tex/note.tex}
\mainmatter
\renewcommand\thepage{\zhdigits{\arabic{page}}\relax}
\chapter[{\small 周文}]{周文}
\input{tex/book_1.tex}
\chapter[{\small 周文}]{周文}
\input{tex/book_2.tex}
\chapter[{\small 周文}]{周文}
\input{tex/book_3.tex}
\chapter[{\small 秦文 楚辭}]{秦文 楚辭}
\input{tex/book_4.tex}
\chapter[{\small 漢文}]{漢文}
\input{tex/book_5.tex}
\chapter[{\small 漢文}]{漢文}
\input{tex/book_6.tex}
\chapter[{\small 六朝 唐文}]{六朝 唐文}
\input{tex/book_7.tex}
\chapter[{\small 唐文}]{唐文}
\input{tex/book_8.tex}
\chapter[{\small 唐宋文}]{唐宋文}
\input{tex/book_9.tex}
\chapter[{\small 宋文}]{宋文}
\input{tex/book_10.tex}
\chapter[{\small 宋文}]{宋文}
\input{tex/book_11.tex}
\chapter[{\small 明文}]{明文}
\input{tex/book_12.tex}
\end{document}