-
Notifications
You must be signed in to change notification settings - Fork 23
/
beamerthemeHeavenlyClouds.sty
220 lines (197 loc) · 8.14 KB
/
beamerthemeHeavenlyClouds.sty
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
% beamerthemeHeavenlyClouds.sty v1.2 2024/10/15
% by LianTze Lim ([email protected])
\ProvidesPackage{beamerthemeHeavenlyClouds}
\RequirePackage{cncolours}
\RequirePackage{pgfornament-han}
\RequirePackage{tikz}
\usetikzlibrary{decorations,decorations.markings}
\RequirePackage{calc}
\setbeamercolor{structure}{fg=殷红}
\setbeamercolor{headline}{fg=殷红}
\setbeamercolor{page number in head/foot}{fg=殷红}
\setbeamercolor{normal text}{bg=牙色}
\setbeamercolor{alerted text}{fg=紫棠}
\setbeamercolor{example text}{fg=松花绿}
% \setbeamercolor{section name}{fg=structure!80!black}
\setbeamerfont{section name}{size=\Huge,family=\lishu}
\setbeamerfont{section title}{size=\Huge,family=\lishu}
\setbeamerfont{section in toc}{family=\lishu}
\usefonttheme[stillsansserifsmall]{serif}
\renewcommand{\CJKrmdefault}{zhfs}
\setbeamerfont{frametitle}{shape=\itshape,family=\lishu,series=\bfseries,size=\LARGE}
\setbeamerfont{framesubtitle}{shape=\itshape,family=\lishu,series=\bfseries,size=\normalsize}
% \setbeamercolor{frametitle}{fg=茜色}
\setbeamerfont{title}{family=\lishu,series=\bfseries,size=\huge}
\setbeamertemplate{itemize items}{$\diamond$}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{frametitle continuation}[from second]
\newif\if@clouds@alttitlecircle
\newcommand{\alttitlecircle}{%
\@clouds@alttitlecircletrue%
}
\preto{\maketitle}{%
\def\title@circle@rotate{45}%
\def\title@circle@symmetry{none}%
\if@clouds@alttitlecircle
\def\title@circle@rotate{0}%
\def\title@circle@symmetry{h}%
\fi%
\newbox{\clouds@title@circle@elem}%
\savebox{\clouds@title@circle@elem}{%
\tikzset{pgfornamentstyle/.style={transform shape,rotate=\title@circle@rotate}}%
\usebeamercolor{headline}%
\pgfornamenthan[width=1.0471cm,
color=headline.fg!80!black,
symmetry=\title@circle@symmetry]{74}%
}
\begin{minipage}{4cm}
\begin{tikzpicture}
\begin{scope}[decoration={markings, mark=between positions 0 and 1 step 1.0471cm
with { \node[transform shape,inner sep=0pt,outer sep=0pt]{\usebox{\clouds@title@circle@elem}}; }} ]
\path [postaction={decorate}] circle (2cm);
\end{scope}%
\node {\inserttitlegraphic};
\end{tikzpicture}%
\end{minipage}%
\hfill\titlegraphic{}
\begin{minipage}{\dimexpr\textwidth-5cm}
}
\appto{\maketitle}{\end{minipage}}
\newcommand{\addheight}{\parbox{0pt}{\rule{0pt}{1.3\ccwd}}}
% \setbeamerfont{block title}{series=\addheight}
% \setbeamerfont{block title}{series=\centering}
% \addtobeamertemplate{block alerted begin}{}{\centering}
% \addtobeamertemplate{block example begin}{}{\centering}
\addtobeamertemplate{block begin}{
\preto{\insertblocktitle}{\raisebox{0.75ex}{\pgfornamenthan[width=1em]{44}\space}}
% \appto{\insertblocktitle}{\raisebox{0.5ex}{\space\pgfornamenthan[width=1em]{44}}}
}{}
\addtobeamertemplate{block alerted begin}{
\preto{\insertblocktitle}{\raisebox{0.75ex}{\pgfornamenthan[width=1em]{44}\space}}
% \appto{\insertblocktitle}{\raisebox{0.5ex}{\space\pgfornamenthan[width=1em]{44}}}
}{}
\addtobeamertemplate{block example begin}{
\preto{\insertblocktitle}{\raisebox{0.75ex}{\pgfornamenthan[width=1em]{44}\space}}
% \appto{\insertblocktitle}{\raisebox{0.5ex}{\space\pgfornamenthan[width=1em]{44}}}
}{}
\newlength{\clouds@frametitle@rawwidth}%
\newlength{\clouds@frametitle@actualwidth}%
\def\clouds@progressmarker{}
\newcommand{\simpleprogressmarker}{%
\renewcommand{\clouds@progressmarker}{%
\clip (-1.25em,2em) rectangle (\paperwidth,0pt);
\fill[headline.fg] (\clouds@progressinheadfoot,1.25em) circle (2pt);
}%
}
\newlength{\ShenmaMarkerWidth}
\setlength{\ShenmaMarkerWidth}{2.5em}
\AddToHook{begindocument/before}{%
\newbox{\clouds@shenma}
\savebox{\clouds@shenma}{%
\usebeamercolor[fg]{headline}%
\tikzset{pgfornamentstyle/.style={line width=0pt}}%
\pgfornamenthan[width=\ShenmaMarkerWidth]{78}%
}
}
\newcommand{\shenmaprogressmarker}{%
\renewcommand{\clouds@progressmarker}{%
\clip (-1.3em,\dimexpr\ht\clouds@shenma + 4em\relax) rectangle (\paperwidth,0pt);
\node[anchor=south,inner sep=1pt] at (\clouds@progressinheadfoot,1.25em)
{\usebox{\clouds@shenma}};
}
}%
\AddToHook{begindocument/before}{%
\shenmaprogressmarker
\newbox{\clouds@title@deco}
\savebox{\clouds@title@deco}{%
\usebeamercolor{headline}%
\pgfornamenthan[width=3.5em,color=headline.fg]{70}%
}
\setbeamertemplate{frametitle}{%
\settowidth{\clouds@frametitle@rawwidth}{\insertframetitle}%
\pgfmathsetlength{\clouds@frametitle@actualwidth}{max(\clouds@frametitle@rawwidth,\textwidth)}
\vskip.25em\centering%
\usebeamerfont{frametitle}\usebeamercolor{frametitle}%
\begin{minipage}{\clouds@frametitle@actualwidth}%
\raisebox{0.5ex}{\reflectbox{\usebox{\clouds@title@deco}}}\hfill%
\parbox{\dimexpr\clouds@frametitle@actualwidth-5em}{\centering\insertframetitle}%
\hfill\raisebox{0.5ex}{\usebox{\clouds@title@deco}}%
\end{minipage}\par%
% 2024-10-08 add frame subtitle
\smallskip%
{\centering\usebeamerfont{framesubtitle}\mbox{}\insertframesubtitle\par}%
}
\newbox{\clouds@smallhuiwen}
\savebox{\clouds@smallhuiwen}{\usebeamerfont{headline}\usebeamercolor{headline}\pgfornamenthan[width=2.5em,color=headline.fg]{39}}
\setbeamertemplate{headline}{%
\tikzset{every node/.append style={inner xsep=0pt}}%
\begin{tikzpicture}[decoration={markings, mark=between positions 0 and 1 step 2.5em
with { \node[transform shape]{\usebox{\clouds@smallhuiwen}}; }} ]
\path [postaction={decorate}] (0,0) -- (\paperwidth,0);
\end{tikzpicture}
}
\newlength{\clouds@progressinheadfoot}
\setbeamertemplate{footline}{%
\tikzset{every node/.append style={inner xsep=0pt}}%
\setlength{\clouds@progressinheadfoot}{%
\paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt} - 1.25em%
}
\begin{tikzpicture}[decoration={markings, mark=between positions 0 and 1 step 2.5em
with { \node[transform shape]{\usebox{\clouds@smallhuiwen}}; }} ]
\path [postaction={decorate}] (0,0) -- (\paperwidth,0);
\draw[headline.fg!50,line width=0.2ex] (-1.25em,1.25em) -- (\paperwidth,1.25em);
\clouds@progressmarker
\end{tikzpicture}
}
}
\AtBeginSection{\begin{frame}\sectionpage\end{frame}}
\renewcommand{\thesection}{\chinese{section}}
\newlength{\cloud@secname@height}
\setbeamertemplate{section page}{
\usebeamercolor{section title}\usebeamercolor{section name}
\newbox{\clouds@section@circle@elem}
\savebox{\clouds@section@circle@elem}{%
\usebeamercolor{headline}%
\pgfornamenthan[width=1.0471cm,color=headline.fg!80!black]{59}%
}
\settototalheight{\cloud@secname@height}{\usebeamerfont{section name}节}
\begin{tikzpicture}
\begin{scope}[decoration={markings, mark=between positions 0 and 1 step 1.0471cm
with { \node[transform shape,inner sep=0pt,outer sep=0pt,draw=none]{\usebox{\clouds@section@circle@elem}}; }} ]
\path [postaction={decorate}] circle (1.5cm);
\end{scope}%
\node[anchor=center,text height=\cloud@secname@height,text=section name.fg,font=\usebeamerfont{section name}] {\thesection};
\node[anchor=west,text=section title.fg,font=\usebeamerfont{section title},
text width=\dimexpr\textwidth-5cm\relax] at (2.5cm,0) {\insertsection};
\end{tikzpicture}
}
\RequirePackage{pgfmath}
\newcommand{\randorn}[1]{%
\pgfmathsetmacro{\myscale}{(rnd * 0.4 + 0.1)}
\pgfmathsetmacro{\myintensity}{rnd * 20 + 65}
\pgfmathsetmacro{\mychoice}{int (ifthenelse(rand > 0, 1, -1)}
% \pgfmathparse{int(rand)}
\ifnum\mychoice > 0\relax
\def\myflip{v}
\else
\def\myflip{none}
\fi
\pgfmathsetmacro{\myx}{rnd * 0.8}
\pgfmathsetmacro{\myy}{rnd * 0.8}
\pgfmathtruncatemacro{\myorn}{random(0,1) + #1}
\begingroup
\ifodd \myorn \tikzset{pgfornamentstyle/.append style={line width=1pt]}} \fi
\node at (\myx * \paperwidth, \myy * \paperheight) {\pgfornamenthan[
color=normal text.bg!\myintensity!white,symmetry=\myflip,scale=\myscale]{\myorn}};
\endgroup
}
\newcommand{\BackgroundOrns}{\randorn{66}\randorn{68}\randorn{66}\randorn{70}\randorn{68}}
\setbeamertemplate{background}{%
\begin{tikzpicture}
\clip (0,0) rectangle (\paperwidth,\paperheight);
\BackgroundOrns%
\end{tikzpicture}
}
%% 默认寿字纹图案
\titlegraphic{\usebeamercolor{headline}\pgfornamenthan[width=2.5cm,color=headline.fg]{56}}
\endinput