fix(pdf): center cover pages and prefer TeX Gyre Termes

This commit is contained in:
Zhengshou Lai
2026-07-29 15:58:04 +08:00
parent 8f60860419
commit 01165b5a69
4 changed files with 15 additions and 12 deletions
+6 -6
View File
@@ -18,13 +18,13 @@
\usepackage{caption} \usepackage{caption}
\usepackage{hyperref} \usepackage{hyperref}
% ---- fonts (Times New Roman + SimSun/SimHei/KaiTi; ctex default set as fallback) ---- % ---- fonts: TeX Gyre Termes + SimSun/SimHei (fallback ctex auto) ----
\IfFontExistsTF{Times New Roman}{\setmainfont{Times New Roman}}{} \xeCJKsetup{CJKecglue = \hspace{0.3em}}
\usepackage{tgtermes}
\IfFontExistsTF{SimSun}{% \IfFontExistsTF{SimSun}{%
\setCJKmainfont[BoldFont={SimHei},ItalicFont={KaiTi}]{SimSun}% \setCJKmainfont[BoldFont={SimHei},ItalicFont={KaiTi}]{SimSun}%
\setCJKsansfont[BoldFont={SimHei}]{SimHei}% \setCJKsansfont[BoldFont={SimHei}]{SimHei}%
}{} }{}
\IfFontExistsTF{Courier New}{\setmonofont{Courier New}}{\setmonofont{Menlo}}
% ---- vertical rhythm (keep in sync with Typst md-to-pdf/manual template) ---- % ---- vertical rhythm (keep in sync with Typst md-to-pdf/manual template) ----
% Typst: leading 0.76em, paragraph spacing 1.08em % Typst: leading 0.76em, paragraph spacing 1.08em
@@ -117,16 +117,16 @@
\begin{document} \begin{document}
% ---- cover page ---- % ---- cover page (vertically centered) ----
\begin{titlepage} \begin{titlepage}
\vspace*{\fill}
\centering \centering
\vspace*{2cm}
{\fontsize{28}{34}\selectfont\bfseries\color{primary} Phynexis Python API 参考手册\par} {\fontsize{28}{34}\selectfont\bfseries\color{primary} Phynexis Python API 参考手册\par}
\vspace{0.8cm} \vspace{0.8cm}
{\fontsize{16}{20}\selectfont\color{accent} 技术与使用文档\par} {\fontsize{16}{20}\selectfont\color{accent} 技术与使用文档\par}
\vspace{2cm} \vspace{2cm}
{\fontsize{12}{16}\selectfont\color{light} 2026 年 7 月\par} {\fontsize{12}{16}\selectfont\color{light} 2026 年 7 月\par}
\vfill \vspace*{\fill}
\end{titlepage} \end{titlepage}
\tableofcontents \tableofcontents
@@ -7,8 +7,8 @@
#let cover-page(title, subtitle, date) = { #let cover-page(title, subtitle, date) = {
page(margin: (top: 3cm, bottom: 3cm, left: 3cm, right: 3cm))[ page(margin: (top: 3cm, bottom: 3cm, left: 3cm, right: 3cm))[
#align(center + horizon)[ #v(1fr)
#v(2cm) #align(center)[
#text(size: 28pt, weight: "bold", fill: primary, title) #text(size: 28pt, weight: "bold", fill: primary, title)
#if subtitle != none { #if subtitle != none {
v(0.8cm) v(0.8cm)
@@ -19,6 +19,7 @@
text(size: 12pt, fill: light, date) text(size: 12pt, fill: light, date)
} }
] ]
#v(1fr)
] ]
} }
@@ -16,8 +16,8 @@
#let cover-page(title, subtitle, date) = { #let cover-page(title, subtitle, date) = {
page(margin: (top: 3cm, bottom: 3cm, left: 3cm, right: 3cm))[ page(margin: (top: 3cm, bottom: 3cm, left: 3cm, right: 3cm))[
#align(center + horizon)[ #v(1fr)
#v(2cm) #align(center)[
#text(size: 28pt, weight: "bold", fill: primary, title) #text(size: 28pt, weight: "bold", fill: primary, title)
#if subtitle != none { #if subtitle != none {
v(0.8cm) v(0.8cm)
@@ -28,6 +28,7 @@
text(size: 12pt, fill: light, date) text(size: 12pt, fill: light, date)
} }
] ]
#v(1fr)
] ]
} }
@@ -95,8 +95,8 @@
#let cover-page(title, subtitle, date) = { #let cover-page(title, subtitle, date) = {
page(margin: (top: 3cm, bottom: 3cm, left: 3cm, right: 3cm))[ page(margin: (top: 3cm, bottom: 3cm, left: 3cm, right: 3cm))[
#align(center + horizon)[ #v(1fr)
#v(2cm) #align(center)[
#text(size: 28pt, weight: "bold", fill: primary, title) #text(size: 28pt, weight: "bold", fill: primary, title)
#if subtitle != none { #if subtitle != none {
v(0.8cm) v(0.8cm)
@@ -107,6 +107,7 @@
text(size: 12pt, fill: light, date) text(size: 12pt, fill: light, date)
} }
] ]
#v(1fr)
] ]
} }