-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsybook.cls
117 lines (107 loc) · 2.99 KB
/
sybook.cls
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
% sybook is built by Ran Wang
% Email: ranwang.osbert@outlook.com
% !TeX root = main.tex
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{sybook}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\newif\ifgeobook@customfont
\newif\ifgeobook@overleaf
\DeclareOption{customfont}{\geobook@customfonttrue}
\DeclareOption{systemfont}{\geobook@customfontfalse}
\DeclareOption{overleaf}{\geobook@overleaftrue}
\ExecuteOptions{systemfont}
\ProcessOptions\relax
% -- overleaf 上默认的 fandol 中文字体经常缺字,因此设定缺字处理手段 --
\ifgeobook@customfont\else
\ifgeobook@overleaf
\PassOptionsToPackage{AutoFallBack=true}{xeCJK}
\fi
\fi
\LoadClass{ctexbook}
\ctexset{
chapter = {
name = {第,回},
nameformat = {\centering\pgfornamenthan[scale=0.05,symmetry=h]{59}\par},
titleformat = {\chaptertitleformat},
aftertitle = {\par\centering\pgfornamenthan[scale=0.05,ydelta=-15pt]{59}},
pagestyle = empty,
}
}
\newcommand{\chaptertitleformat}[1]{
\makebox[3\ccwd][s]{\huge\bfseries#1}
}
\RequirePackage[
a4paper,
inner = 1in,
outer = 1.25in,
vmargin = 1in
]{geometry}
\RequirePackage{fancyhdr}
\fancyhf{}
\fancyhead[LE,RO]{\leftmark}
\fancyfoot[LE,RO]{
\begin{tikzpicture}
\node at (0,0) {\pgfornamenthan[scale=0.05,symmetry=v]{71}};
\node at (0.7,0) {\thepage};
\node at (1.4,0) {\pgfornamenthan[scale=0.05]{71}};
\end{tikzpicture}
}
\pagestyle{fancy}
\renewcommand\sectionmark[1]{\markright{#1}}
\RequirePackage{ifxetex}
\RequireXeTeX
\ifxetex
\else
\ClassError{ctexbook}{Use `xelatex' driver}{%
Choose `xelatex' driver or contact ranwang.osbert@outlook.com%
}
\fi
\ifgeobook@customfont
\setCJKmainfont{Source Han Serif SC}[
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Regular,
BoldItalicFont = *-Bold
]
\setCJKsansfont{Source Han Sans SC}[
UprightFont = *-Medium,
BoldFont = *-Bold,
ItalicFont = *-Medium,
BoldItalicFont = *-Bold
]
\setCJKmonofont{Source Han Sans SC}[
UprightFont = *-Light,
BoldFont = *-Medium,
AutoFakeSlant = 0.2
]
\else
% -- overleaf 上默认的 fandol 中文字体缺字时,引 Noto Sans CJK SC 字体补充 --
\ifgeobook@overleaf
\setCJKfallbackfamilyfont{\CJKrmdefault}[Scale=0.92]{Noto Sans CJK SC}
\fi
\fi
\RequirePackage[%
colorlinks,
pdfstartview = FitH]{hyperref}
\RequirePackage{pgfornament-han}
\renewcommand{\and}{\\[0.5\ccwd]}
\renewcommand{\maketitle}
{
\begin{titlepage}
\thispagestyle{empty}
\pagestyle{empty}
\setlength{\parindent}{0pt}
\vspace*{0.15\textheight}
\begin{minipage}{\linewidth}
\centering
\begin{tikzpicture}
\node (A) at (0,0) {\pgfornamenthan[scale=0.18]{6}};
\node at (4.5,-1) {\makebox[0.5\linewidth][s]{\Huge\bfseries\@title}};
\node at (10,-4) {\begin{minipage}[t]{0.25\linewidth}\large\@author\end{minipage}};
\node (B) at (12.5,-5) {\pgfornamenthan[scale=0.18,symmetry=c]{6}};
\end{tikzpicture}
\end{minipage}
\newpage
\thispagestyle{empty}
\end{titlepage}
}