summaryrefslogtreecommitdiff
path: root/macros/xetex/latex/cqubeamer/cqubeamer.sty
blob: 2e844f7b4563253cbf62504d40891f1d9ee54c45 (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
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
% Layout scheme for outer elements: split header and footer
\useoutertheme{split}
\useoutertheme{smoothbars}

% Color scheme for outer elements: use background colors
\usecolortheme{whale}

% Layout scheme for inner elements: rounded elements
\useinnertheme[shadow=true]{rounded}

% Color scheme for inner elements: use foreground colors
\usecolortheme{orchid}

% Itemize items: default (triangle), circle, square, ball
\setbeamertemplate{itemize items}[ball]

% Enumerate items: default, circle, square, ball
\setbeamertemplate{enumerate items}[ball]

% Outline: default, sections numbered, subsections numbered, circle, square, ball, ball unnumbered
\setbeamertemplate{sections/subsections/subsubsections in toc}[default]

% General blocks:
\setbeamertemplate{blocks}[rounded][shadow=true]

% Title page:
\setbeamertemplate{title page}[default][colsep=-4bp,rounded=true]

% Part page:
\setbeamertemplate{part page}[default][colsep=-4bp,rounded=true]

% Background
%\pgfdeclareimage[width=\paperwidth,height=0.95\paperheight]{bg}{cqubackground}
%\setbeamertemplate{background}{\pgfuseimage{bg}}

% Colors
\usecolortheme[RGB={36,73,164}]{structure}

\setbeamercolor{frametitle}{parent=subsection in head/foot}
\setbeamercolor{frametitle right}{parent=subsection in head/foot}
\setbeamercolor{frametitle right}{parent=subsubsection in head/foot}

\definecolor{titlebg}{RGB}{36,72,164}
\setbeamercolor{frametitle}{fg=white,bg=titlebg}
\setbeamercolor{section in head/foot}{fg=white,bg=titlebg}
\setbeamercolor{subsection in head/foot}{fg=white,bg=titlebg}

\pgfdeclarehorizontalshading[frametitle.bg,frametitle right.bg]{beamer@frametitleshade}{\paperheight}{%
  color(0pt)=(frametitle.bg);
  color(\paperwidth)=(frametitle right.bg)}

\AtBeginDocument{
  \pgfdeclareverticalshading{beamer@topshade}{\paperwidth}{%
    color(0pt)=(bg);
    color(4pt)=(black!50!bg)}
}

%%% 设置目录页各级标题显示与否
\AtBeginSection[]{ 
  \begin{frame}
   \frametitle{目录}
    \begin{multicols}{2}
     \tableofcontents[current, subsubsectionstyle=hide] %subsubsectionstyle=hide 目录页隐藏三级标题,但书签中存在
%     \tableofcontents[current, currentsubsection]   
    \end{multicols}
  \addtocounter{framenumber}{-1} 
  \end{frame}
}


% footline: author | title | date and framenumber

\defbeamertemplate*{footline}{cqu theme}{%
\setbeamercolor{footcolor}{fg=while,bg=blue!55}
  \leavevmode%
  \hbox{%
    \begin{beamercolorbox}[wd=0.30\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
      \usebeamerfont{author in head/foot}{\insertshortauthor}
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=0.40\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
     \usebeamerfont{title in head/foot}{\insertshorttitle}
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=0.30\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
      \usebeamerfont{date in head/foot}{\insertdate}
      \hspace*{2em}  
      \insertframenumber{}/\inserttotalframenumber\hspace*{2ex} 
    \end{beamercolorbox}
  }%
  \vskip0pt%
}


\defbeamertemplate*{headline}{cqu theme}{%
  \leavevmode%
  \@tempdimb=6.4375ex%
    \pgfdeclareimage[height=.95\@tempdimb]{logo}{logo/cqulogo.pdf}%
    \pgfdeclareimage[height=1.\@tempdimb]{title_logo}{logo/cquname.pdf}%
  \logo{\pgfuseimage{logo}}%
  \ifdim\@tempdimb>0pt%
    \advance\@tempdimb by 1.125ex%
    \begin{beamercolorbox}[wd=.8\paperwidth,ht=\@tempdimb,center]{subsection in head/foot}%
      \vbox to\@tempdimb{\vfil\insertnavigation{.5\textwidth}{\hskip0pt 
      plus1filll}{}\vfil}
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.135\paperwidth,ht=\@tempdimb,center]{subsection in head/foot}%
      \vbox to\@tempdimb{\vfil\pgfuseimage{title_logo}\vfil}%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.065\paperwidth,ht=\@tempdimb,center]{subsection in head/foot}%
      \vbox to\@tempdimb{\vfil\insertlogo\vfil\vfil}%
    \end{beamercolorbox}%
  \fi%
}

\defbeamertemplate*{frametitle}{cqu theme}{%
  \nointerlineskip%
  \hbox{\leavevmode
    \advance\beamer@leftmargin by -12bp%
    \advance\beamer@rightmargin by -12bp %
    \beamer@tempdim=\textwidth%
    \advance\beamer@tempdim by \beamer@leftmargin%
    \advance\beamer@tempdim by \beamer@rightmargin%
    \hskip-\Gm@lmargin\hbox{%
      \setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{\paperwidth}%
          \vbox{}\vskip-.75ex%
          \leftskip0.3cm%
          \rightskip= 0pt plus1fil \leavevmode
          \insertframetitle%
          \ifx\insertframesubtitle\@empty%
            \strut\par%
          \else
            \par{\usebeamerfont*{framesubtitle}{\usebeamercolor[bg]{framesubtitle}\insertframesubtitle}\strut\par}%
          \fi%
          \nointerlineskip
          \vbox{}%
          \end{minipage}}%
      \beamer@tempdim=\ht\beamer@tempbox%
      \advance\beamer@tempdim by 2pt%
      \begin{pgfpicture}{0mm}{0pt}{\paperwidth}{\beamer@tempdim}
        \usebeamercolor{frametitle right}
        \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
        \pgfusepath{clip}
        \pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
      \end{pgfpicture}
      \hskip-\paperwidth%
      \box\beamer@tempbox%
    }%
    \hskip-\Gm@rmargin%
  }%
}

%%% 定制封面页
\makeatletter
\defbeamertemplate*{title page}{mydefault}[1][]
{
  \vbox{}
  \vfill
  \begingroup
    \centering
    \parbox{.55\paperwidth}{   % 修改数字调整标题页中标题背景框长度
    \begin{beamercolorbox}[wd=\linewidth,sep=8pt,center,#1]{title}
      \usebeamerfont{title}\inserttitle\par%
      \ifx\insertsubtitle\@empty%
      \else%
        \vskip0.25em%
        {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
      \fi%     
    \end{beamercolorbox}%
    }
    \vskip1em\par
    \begin{beamercolorbox}[sep=8pt,center,#1]{author}
      \usebeamerfont{author}\insertauthor
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center,#1]{institute}
      \usebeamerfont{institute}\insertinstitute
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center,#1]{date}
      \usebeamerfont{date}\insertdate
    \end{beamercolorbox}\vskip0.5em
    {\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
  \endgroup
  \vfill
}
\setbeamertemplate{title page}[mydefault][colsep=-4bp,rounded=true,shadow=\beamer@themerounded@shadow]
\makeatother


\usepackage{hyperref}   % 超链接相关设置
\hypersetup{
      pdftitle = {},
	  pdfauthor = {},
	  linktoc=all,
	  bookmarksnumbered=true,  %书签编号
	  bookmarksopen=true,
	  bookmarksopenlevel=4,
	  breaklinks=true,
      colorlinks=false,
      linkcolor=blue,
      anchorcolor=black,
      citecolor=green,
      urlcolor=magenta
}

%%% 书签章节从1开始编号
\setcounter{tocdepth}{4}
% get numbering in section bookmarks
\usepackage{etoolbox}
\usepackage{bookmark}
\makeatletter

\newcounter{realsection}
\newif\ifrealsection
\long\def\beamer@@ssection*#1{\realsectionfalse\beamer@section[{#1}]{}}
\long\def\beamer@@@section#1{\realsectiontrue\beamer@section[{#1}]{#1}}

\patchcmd{\beamer@section}%
    {\refstepcounter{section}}%
    {\ifrealsection\refstepcounter{realsection}\fi\refstepcounter{section}}%
    {}{\errmessage{failed to patch}}

\patchcmd{\beamer@section}%
    {\Hy@writebookmark{\the\c@section}{\secname}}%
    {\Hy@writebookmark{\the\c@section}{\numberline{\therealsection}\secname}}%
    {}{\errmessage{failed to patch}}
\patchcmd{\beamer@subsection}%
   {\Hy@writebookmark{\the\c@subsection}{#2}}%
    {\Hy@writebookmark{\the\c@subsection}{\numberline{\therealsection.\thesubsection}#2}}%
    {}{\errmessage{failed to patch}}
\patchcmd{\beamer@subsubsection}%
    {\Hy@writebookmark{\the\c@subsubsection}{#2}}%
    {\Hy@writebookmark{\the\c@subsubsection}{\numberline{\therealsection.\thesubsection.\thesubsubsection}#2}}%
    {}{\errmessage{failed to patch}}
\makeatother


%%% 每页脚注从“1”开始编号
\usepackage{perpage}
\MakePerPage{footnote}

%%% 设置脚注标号颜色
\makeatletter
\renewcommand\@makefnmark{\hbox{\@textsuperscript{\normalfont\color{blue}\@thefnmark}}}
\renewcommand\@makefntext[1]{%
  \parindent 1em\noindent
            \hb@xt@1.8em{%
                \hss\@textsuperscript{\normalfont\@thefnmark}}#1}
\makeatother