Skip to content

Commit 7565942

Browse files
committed
feat(docs): Beautify PDF document styles
1 parent 8358018 commit 7565942

1 file changed

Lines changed: 39 additions & 3 deletions

File tree

source/conf.py

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,55 @@
9292
\usepackage{xcolor}
9393
\usepackage{graphicx}
9494
\usepackage{eso-pic}
95+
\usepackage{indentfirst}
9596
\usepackage{hyperref}
97+
\usepackage{fancyhdr}
98+
\pagestyle{fancy}
9699
97100
\hypersetup{
98101
bookmarksnumbered=true,
99102
bookmarksopen=true,
100103
bookmarksopenlevel=2
101104
}
102105
106+
\makeatletter % 自定义页眉与页脚
107+
% 章标题更新 \leftmark 节标题更新 \rightmark
108+
% \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
109+
% \renewcommand{\sectionmark}[1]{\markright{#1}}
110+
111+
\renewcommand{\chaptermark}[1]{%
112+
\markboth{第\thechapter\ 章\ #1}{}
113+
}
114+
\renewcommand{\sectionmark}[1]{%
115+
\markright{\thesection\ #1}{}
116+
}
117+
118+
% 自定义 normal 样式:用于文档的普通页面
119+
\fancypagestyle{normal}{
120+
\fancyhf{} % 清除所有默认的页眉页脚设置
121+
\fancyhead[L]{\nouppercase{\leftmark}} % 左侧页眉内容
122+
\fancyhead[C]{\textbf{\@title}} % 中间页眉内容
123+
\fancyhead[R]{\nouppercase{\rightmark}} % 右侧页眉内容
124+
% \fancyfoot[L]{} % 左侧页脚内容
125+
\fancyfoot[C]{\textbf{\thepage}} % 中间页脚内容
126+
% \fancyfoot[R]{} % 右侧页脚内容
127+
\renewcommand{\headrulewidth}{0.4pt} % 设置页眉线的宽度
128+
\renewcommand{\footrulewidth}{0.4pt} % 设置页脚线的宽度
129+
}
130+
131+
% 自定义 plain 样式:用于章节的首页(默认不显示页眉,只显示页脚)
132+
\fancypagestyle{plain}{
133+
\fancyhf{} % 清除所有默认设置
134+
\fancyfoot[C]{\textbf{\thepage}} % 章节首页通常只显示页码
135+
\renewcommand{\headrulewidth}{0pt} % 章节首页通常不显示页眉线
136+
\renewcommand{\footrulewidth}{0.4pt} % 章节首页通常不显示页脚线
137+
}
138+
\makeatother
139+
103140
\definecolor{ChapterColorScheme}{RGB}{24, 112, 125}
104141
\definecolor{SectionColorScheme}{RGB}{98, 137, 196}
105142
\definecolor{SubsectionColorScheme}{RGB}{88, 161, 174}
106143
107-
\setlength{\parindent}{2em}
108-
\usepackage{indentfirst}
109-
110144
\ctexset{
111145
contentsname = {目录},
112146
part = {
@@ -141,6 +175,8 @@
141175
}
142176
}
143177
178+
\setlength{\parindent}{2em} % 首行缩进
179+
144180
\makeatletter
145181
\renewcommand{\@pnumwidth}{2.5em}
146182
\renewcommand{\@tocrmarg}{3.5em}

0 commit comments

Comments
 (0)