Skip to content

Commit 462344e

Browse files
committed
feat(docs): Optimize document layout configuration
1 parent 3764705 commit 462344e

1 file changed

Lines changed: 19 additions & 28 deletions

File tree

source/conf.py

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -78,45 +78,36 @@
7878
\PassOptionsToPackage{svgnames}{xcolor}
7979
''',
8080
'fontpkg': r'''
81+
% [EN]
8182
\setmainfont{Source Han Sans SC}
8283
\setsansfont{Source Han Sans SC}
8384
\setmonofont{Fira Code}
85+
% [CN]
86+
\setCJKmainfont{Source Han Sans SC}
87+
\setCJKsansfont{Source Han Sans SC}
88+
\setCJKmonofont{Source Han Sans SC}
8489
''',
8590
'preamble': r'''
86-
\usepackage[titles]{tocloft}
91+
\usepackage[UTF8, heading=true, fontset=none]{ctex}
8792
\usepackage{graphicx}
8893
\usepackage{eso-pic}
8994
90-
% ===== ===== 设置目录标题 ===== =====
91-
\makeatletter
92-
\renewcommand{\tableofcontents}{%
93-
\cleardoublepage
94-
\chapter*{%
95-
\vspace*{1.2cm}
96-
\makebox[\textwidth][c]{\Huge\bfseries 目录}
97-
}
98-
\thispagestyle{empty}
99-
\@mkboth{目录}{目录}
100-
\@starttoc{toc}
95+
\ctexset{
96+
contentsname = {目录},
97+
part = {
98+
name = {第, 部分},
99+
number = \chinese{part}
100+
},
101+
chapter = {
102+
name = {第, 章},
103+
number = \arabic{chapter},
104+
format = \Huge\bfseries\centering
101105
}
102-
\makeatother
106+
}
103107
104108
\makeatletter
105-
\renewcommand{\cftchappresnum}{第}
106-
\renewcommand{\cftchapaftersnum}{章}
107-
\setlength{\cftchapnumwidth}{4.5em}
108-
\makeatother
109-
% ===== ===== 设置文档标题 ===== =====
110-
\makeatletter
111-
\renewcommand{\@makechapterhead}[1]{
112-
{\parindent \z@ \centering \normalfont
113-
\ifnum \c@secnumdepth >\m@ne
114-
\Huge\bfseries 第\ \thechapter\ 章\quad #1\par\nobreak
115-
\fi
116-
\interlinepenalty\@M
117-
\vspace*{20pt}
118-
}
119-
}
109+
\renewcommand{\@pnumwidth}{2.5em}
110+
\renewcommand{\@tocrmarg}{3.5em}
120111
\makeatother
121112
''',
122113
'maketitle': r'''

0 commit comments

Comments
 (0)