-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatlas_style.sty
More file actions
176 lines (155 loc) · 6.74 KB
/
atlas_style.sty
File metadata and controls
176 lines (155 loc) · 6.74 KB
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
\ProvidesPackage{atlas_style}[2026/02/20 Rosetta Stone Style for Deep Learning Math]
% --- 核心字体与编码 (XeLaTeX 兼容) ---
\RequirePackage{amsmath, amsfonts, amssymb}
\RequirePackage{newtxmath} % 提供 Times 风格的数学符号
\RequirePackage{fontspec} % XeLaTeX 字体引擎
\setmainfont{TeX Gyre Termes} % 高质量 Times 克隆字体,CI 环境兼容
% --- 核心宏包 ---
\RequirePackage{geometry}
\RequirePackage{graphicx}
\RequirePackage{xcolor}
\RequirePackage{caption}
\RequirePackage[many]{tcolorbox}
\tcbuselibrary{skins, breakable}
\RequirePackage{titlesec}
\RequirePackage{fancyhdr}
\RequirePackage{natbib}
\RequirePackage{hyperref}
\RequirePackage{bookmark}
\RequirePackage{tikz}
\usetikzlibrary{shapes.geometric, arrows.meta, positioning, shadows, fit, backgrounds, calc, decorations.pathmorphing}
% --- 配色定义 ---
\definecolor{maintheme}{RGB}{34, 107, 128} % 深青色
\colorlet{MAINTHEME}{maintheme} % 别名,防止某些宏包自动大写导致错误
\definecolor{brandblue}{RGB}{0, 114, 178} % 现代蓝
\definecolor{brandorange}{RGB}{213, 94, 0} % 警告橙
\definecolor{brandgreen}{RGB}{0, 158, 115} % 代码绿
\definecolor{softblue}{RGB}{235, 245, 250}
\definecolor{codegrey}{RGB}{245, 245, 245}
\definecolor{deepgrey}{RGB}{51, 51, 51}
% --- 页面几何设置 (不对称宽侧栏) ---
\geometry{
a4paper,
inner=2cm,
outer=5cm,
top=3cm,
bottom=3cm,
marginparsep=0.5cm,
marginparwidth=4cm
}
\hypersetup{colorlinks=true, linkcolor=maintheme, citecolor=maintheme, urlcolor=brandblue}
% --- 段落排版 ---
\linespread{1.3}
\setlength{\parskip}{0.5em}
\setlength{\parindent}{0pt}
% --- 页眉页脚 ---
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\textcolor{gray}{\thepage}}
\fancyhead[LO]{\textcolor{gray}{\leftmark}}
\fancyhead[RE]{\textcolor{gray}{\rightmark}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\headrule}{\hbox to\headwidth{\color{gray}\leaders\hrule\hfill}}
% --- 目录美化 ---
\RequirePackage{titletoc}
\renewcommand{\contentsname}{\hfill \huge\bfseries\color{maintheme} 目录 (Contents) \hfill}
\titlecontents{chapter}[0em]{\addvspace{1.5pc}\bfseries\color{maintheme}}
{\thecontentslabel\quad}{}
{\titlerule*[0.7pc]{.}\contentspage}
\titlecontents{section}[2em]{\addvspace{0.5pc}}
{\thecontentslabel\quad}{}
{\titlerule*[0.7pc]{.}\contentspage}
% --- 章节标题美化 ---
\titleformat{\chapter}[display]
{\normalfont\Huge\bfseries\color{maintheme}}
{\titlerule[2pt]\vspace{2pt}\titlerule\vspace{1ex}\chaptertitlename\ \thechapter}
{1ex}
{\Huge}
[\vspace{1ex}\titlerule]
\titleformat{\section}
{\normalfont\Large\bfseries\color{black}}
{\color{maintheme}\thesection}{1em}{}
% --- 核心环境: 罗塞塔左右对照框 ---
\newtcolorbox{rosetta}[2][]{
enhanced,
sidebyside,
sidebyside align=top,
sidebyside gap=6mm,
lower separated=true,
halign=left,
halign lower=center,
colback=white,
colframe=brandblue!30,
colbacktitle=brandblue!10,
coltitle=brandblue,
fonttitle=\bfseries\sffamily,
title=#2,
sharp corners,
boxrule=0.8pt,
titlerule=0pt,
drop fuzzy shadow,
bicolor,
colbacklower=codegrey,
segmentation style={dash pattern=on 3pt off 2pt, brandblue!40, thick},
#1
}
% --- 语义化扁平框 ---
\newtcolorbox{flatblue}[2][]{
enhanced, breakable, sharp corners, boxrule=0pt, frame hidden,
borderline west={3pt}{0pt}{brandblue},
colback=softblue, coltitle=brandblue,
fonttitle=\bfseries\large\sffamily, title=#2,
attach title to upper, after title={\par\medskip},
left=10pt, right=10pt, top=10pt, bottom=10pt, #1
}
% --- 旧版兼容环境 ---
\newtcolorbox{mathbox}[2][]{
enhanced, breakable, colback=white, colframe=brandblue!20,
colbacktitle=brandblue!5, coltitle=brandblue,
fonttitle=\bfseries\large\sffamily, title=#2,
attach boxed title to top left={yshift=-2mm, xshift=5mm},
boxed title style={enhanced, boxrule=0.5pt, colframe=white, shadow={0.3mm}{-0.3mm}{0mm}{black!10!white}},
shadow={0.5mm}{-0.5mm}{0mm}{black!10!white}, separator sign none,
top=12pt, bottom=8pt, left=10pt, right=10pt, #1
}
% --- 核心命令 ---
\newcommand{\pyfunc}[1]{\texttt{\textbf{\textcolor{brandblue}{#1}}}}
% --- TikZ 样式库 (Edition 2.2 Standard) ---
\tikzset{
neuron/.style={circle, draw=brandblue, fill=brandblue!10, minimum size=20pt, thick, drop shadow={opacity=0.2}},
active_neuron/.style={circle, draw=brandorange, fill=brandorange!10, minimum size=20pt, thick, drop shadow={opacity=0.2}},
data_node/.style={rectangle, draw=brandgreen, fill=brandgreen!5, rounded corners=2pt, minimum height=25pt, minimum width=40pt, thick},
op_node/.style={circle, draw=brandorange, fill=brandorange!15, thick, inner sep=1pt, minimum size=18pt},
block/.style={rectangle, draw=brandblue!80, fill=brandblue!5, thick, rounded corners, minimum width=3cm, minimum height=0.8cm, align=center, drop shadow={opacity=0.1}},
norm_block/.style={rectangle, draw=brandgreen!80, fill=brandgreen!5, thick, rounded corners, minimum width=3cm, minimum height=0.8cm, align=center},
attn_block/.style={rectangle, draw=brandorange!80, fill=brandorange!5, thick, rounded corners, minimum width=3cm, minimum height=0.8cm, align=center},
conn/.style={->, >=Stealth, brandblue!60, thick},
skip_conn/.style={->, >=Stealth, brandblue!40, thick, rounded corners=2mm},
data_flow/.style={->, >=Stealth, brandgreen!70, thick},
layer_label/.style={font=\sffamily\scriptsize\bfseries, color=deepgrey},
math_text/.style={font=\small\itshape},
container/.style={rectangle, draw=brandblue!30, fill=white, rounded corners=4pt, inner sep=10pt, dashed, thick},
block_orange/.style={block, draw=brandorange, fill=brandorange!10},
block_green/.style={block, draw=brandgreen, fill=brandgreen!10},
arrow_blue/.style={->, >=Stealth, thick, draw=brandblue}
}
% --- Notation & Variable Environments ---
\RequirePackage{marginfix} % 自动修复边栏重叠
\newcommand{\mnote}[1]{\marginpar{\linespread{1.1}\footnotesize\sffamily\color{deepgrey}#1}}
\newtcolorbox{notation}[1][]{
enhanced, breakable, sharp corners, boxrule=0pt, frame hidden,
borderline west={3pt}{0pt}{brandblue},
colback=softblue, coltitle=brandblue,
fonttitle=\bfseries\large\sffamily, title={Notation},
attach title to upper, after title={\par\medskip},
left=10pt, right=10pt, top=10pt, bottom=10pt, #1
}
\newtcolorbox{variable}[1][]{
enhanced, breakable, sharp corners, boxrule=0pt, frame hidden,
borderline west={3pt}{0pt}{brandgreen},
colback=brandgreen!5, coltitle=brandgreen,
fonttitle=\bfseries\large\sffamily, title={Variable Explanation},
attach title to upper, after title={\par\medskip},
left=10pt, right=10pt, top=10pt, bottom=10pt, #1
}
\endinput