summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/pgfornament-han/beamerthemeXiaoshan.sty
blob: 2058d785ba8c52f8edc48ba51d0cd06519d3fd04 (plain)
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
% beamerthemeXiaoshan.sty v1.0 2018/04/09
% by LianTze Lim (liantze@gmail.com)
\ProvidesPackage{beamerthemeXiaoshan}

\usetheme[progressbar=frametitle]{metropolis}

\RequirePackage{pgfornament-han}
\RequirePackage{tikz}
\usetikzlibrary{decorations,decorations.markings}
\RequirePackage{cncolours}
\RequirePackage{needspace}

\setbeamertemplate{frametitle continuation}[from second]

\renewcommand{\metropolis@colors@dark}{
  \setbeamercolor{normal text}{%
    fg=black!2,
    bg=漆黑
  }
  \usebeamercolor[fg]{normal text}
}
\renewcommand{\metropolis@colors@light}{
  \setbeamercolor{normal text}{%
    fg=漆黑,
    bg=black!2
  }
  \usebeamercolor[fg]{normal text}
}

\metroset{background=light}

\setbeamercolor{alerted text}{fg=酡红}
\setbeamercolor{example text}{fg=靛蓝}

\AtBeginEnvironment{theorem}{%
  \setbeamercolor{block title}{fg=松花绿}
}

\AtBeginEnvironment{proof}{%
  \setbeamercolor{block title}{fg=松花绿}
}

\setbeamercolor{qed symbol}{fg=松花绿}

\setbeamertemplate{title}{
\raggedleft%
\linespread{1.0}%
\inserttitle%
\hspace*{2em}\par%
\vspace*{0.5em}
}

\setbeamertemplate{subtitle}{
\raggedleft%
\insertsubtitle%
\hspace*{2em}\par%
\vspace*{0.5em}
}
\addtobeamertemplate{author}{\raggedleft}{}
\addtobeamertemplate{date}{\raggedleft}{}

\setbeamertemplate{progress bar in head/foot}{
  \nointerlineskip
  \setlength{\metropolis@progressinheadfoot}{%
    \paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
  }%
  \begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot}
    \begin{tikzpicture}%
      \newbox{\orn}
      \savebox{\orn}{\pgfornamenthan[width=1em]{39}}
      \fill[bg!60] (0,0) rectangle (\paperwidth, .55em);
       \clip (0,0) rectangle (\metropolis@progressinheadfoot, .55em);
       \begin{scope}[decoration={markings, mark=between positions 0 and 1 step 1em
  with { \node[transform shape,inner sep=0pt,outer sep=0pt,draw=none]{\usebox{\orn}}; }} ]
       \path [postaction={decorate}] (.5em,.275em) -- (\dimexpr\metropolis@progressinheadfoot+0.5em, .275em);
     \end{scope}%
    \end{tikzpicture}%
  \end{beamercolorbox}
}

\setbeamertemplate{progress bar in section page}{
  \setlength{\metropolis@progressonsectionpage}{%
    \textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
  }%
  \begin{tikzpicture}
    \newbox{\orn}
    \savebox{\orn}{\pgfornamenthan[width=.8em]{39}}
    \fill[bg!60] (0,0) rectangle (\textwidth, .44em);
     \clip (0,0) rectangle (\metropolis@progressonsectionpage, .44em);
     \begin{scope}[decoration={markings, mark=between positions 0 and 1 step .8em
with { \node[transform shape,inner sep=0pt,outer sep=0pt,draw=none]{\usebox{\orn}}; }} ]
     \path [postaction={decorate}] (.4em,.22em) -- (\dimexpr\metropolis@progressonsectionpage+0.5em, .22em);
   \end{scope}%
  \end{tikzpicture}%
}

\setbeamertemplate{title separator}{%
  \vspace*{-5em}%
  \begin{tikzpicture}
    \newbox{\orn}
    \savebox{\orn}{\pgfornamenthan[width=2em]{31}}
    \node[anchor=south east,inner sep=0pt,outer sep=0pt] (endmotif) at (\textwidth,0){\pgfornamenthan[width=2em,symmetry=c]{13}};
    % \node[rotate=90,anchor=south west,inner sep=0pt,outer sep=0pt] at (endmotif.north east) {\pgfornamenthan[width=2em]{31}};
    \begin{scope}[decoration={markings, mark=between positions 0 and 1 step 2em
      with { \node[transform shape,inner sep=0pt,outer sep=0pt,anchor=south]{\usebox{\orn}}; }} ]
    \path [postaction={decorate}] ([yshift=1em]endmotif.north east) -- ++(0,2em);
    \clip (0,1em) rectangle ([yshift=-2pt]endmotif.south west);
    \path [postaction={decorate}] (1em, 0) -- (\textwidth,0);
    \end{scope}%
  \end{tikzpicture}%
\par
}

\@ifpackageloaded{ctex}{%
  \renewcommand{\metropolis@strut}{%
    \vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()\rule[-6pt]{1em}{0pt}}%
  }
}{}

\@ifpackageloaded{CJK}{%
  \renewcommand{\metropolis@strut}{%
    \vphantom{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()\rule[-6pt]{1em}{0pt}}%
  }
}{}


\addtobeamertemplate{block begin}{%
  \needspace{3em}%
  \begin{tikzpicture}[overlay]
    \tikzset{every node/.style={inner sep=0pt,outer sep=0pt,draw=none,松花绿!60}}
    \node[anchor=north]{\pgfornamenthan[width=1.8em]{9}};%
    \node[anchor=north west,xscale=0.5] at (0.9em,0) {\pgfornamenthan[width=1.8em]{29}};%
    \node[anchor=south west,yscale=0.5,rotate=-90] at (-0.9em,-1.8em) {\pgfornamenthan[width=1.8em]{29}};%
  \end{tikzpicture}\vskip-3pt%
 }{}

\addtobeamertemplate{block alerted begin}{%
  \needspace{3em}%
  \begin{tikzpicture}[overlay]
    \tikzset{every node/.style={inner sep=0pt,outer sep=0pt,draw=none, alerted text.fg!60}}
    \node[anchor=north]{\pgfornamenthan[width=1.8em]{9}};%
    \node[anchor=north west,xscale=0.5] at (0.9em,0) {\pgfornamenthan[width=1.8em]{29}};%
    \node[anchor=south west,yscale=0.5,rotate=-90] at (-0.9em,-1.8em) {\pgfornamenthan[width=1.8em]{29}};%
  \end{tikzpicture}\vskip-3pt%
}{}

\addtobeamertemplate{block example begin}{%
  \needspace{3em}%
  \begin{tikzpicture}[overlay]
    \tikzset{every node/.style={inner sep=0pt,outer sep=0pt,draw=none, example text.fg!60}}
    \node[anchor=north]{\pgfornamenthan[width=1.8em]{9}};%
    \node[anchor=north west,xscale=0.5] at (0.9em,0) {\pgfornamenthan[width=1.8em]{29}};%
    \node[anchor=south west,yscale=0.5,rotate=-90] at (-0.9em,-1.8em) {\pgfornamenthan[width=1.8em]{29}};%
  \end{tikzpicture}\vskip-3pt%
}{}

\endinput