summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/beamer-contrib/themes/beamertheme-pure-minimalistic/beamerouterthemepureminimalistic.sty
blob: 65a1d47dadc857fc736405f9af39d0631fe87513 (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
% A pure minimalistic LaTeX-Beamer theme for everyone to use.
% Copyright (C) 2020 Kai Norman Clasen

% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.

% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.

% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <https://www.gnu.org/licenses/>.

% This file is part of beamerthemepureminimalistic.

% If problems/bugs are found or enhancements are desired, please contact
% me over: https://github.com/kai-tub/latex-beamer-pure-minimalistic

\ProvidesPackage{beamerouterthemepureminimalistic}[v2.0.0]
\RequirePackage{ifthen}
\RequirePackage{etoolbox}
\RequirePackage{calc}

\mode<presentation>

\newboolean{showmaxslides}
\setboolean{showmaxslides}{false}
\newboolean{nofooterlogo}
\setboolean{nofooterlogo}{false}

\newboolean{nofooter}
\setboolean{nofooter}{false}

\DeclareOptionBeamer{showmaxslides}{\setboolean{showmaxslides}{true}}
\DeclareOptionBeamer{nofooterlogo}{\setboolean{nofooterlogo}{true}}
\DeclareOptionBeamer{nofooter}{\setboolean{nofooter}{true}}

\ProcessOptionsBeamer

% invertcolor is already processed in colortheme
\ifthenelse{\boolean{darkmode}}{%
  \newcommand{\headerpath}{logos/header_logo_darkmode}
  \newcommand{\institutepath}{logos/institute_logo_darkmode}
}{%
  \newcommand{\headerpath}{logos/header_logo}
  \newcommand{\institutepath}{logos/institute_logo}
}
% The header shares the horizontal space with the frame title in normal mode
% a relative width value between .5 and .8 should usually be the best
\newcommand{\logoheader}{\includegraphics[width=.5\linewidth]{\headerpath}}
% For the title page, the logo is embedded in the total frame, meaning that \linewidth
% here refers to the complete \paperwidth, small width values of < .4 are usually best.
\newcommand{\logotitle}{\includegraphics[width=.2\linewidth]{\headerpath}}
% The footer will only use part of the space under the line. Usually almost the
% full linewidth should be used
\newcommand{\logofooter}{\includegraphics[width=.8\linewidth]{\institutepath}}

\newcommand{\pageword}{Page}
\newcommand{\showpagenum}{%
  \pageword{} \insertframenumber\ifthenelse{%
    \boolean{showmaxslides}%
  }{%
    /\inserttotalframenumber%
  }{}%
}


\defbeamertemplate*{frametitle}{largetitle}{
    \logotitle
}

\newlength{\myleftmargin}
\setlength{\myleftmargin}{.0625\paperwidth}
\newlength{\myrightmargin}
\setlength{\myrightmargin}{.0625\paperwidth}
\newlength{\mytextlength}
\setlength{\mytextlength}{\paperwidth - \myleftmargin - \myrightmargin}
\newlength{\myfooterheight}
\setlength{\myfooterheight}{.08\paperheight}

\setbeamersize{text margin left=\myleftmargin, text margin right=\myrightmargin}
% This cannot be an environment because I need to access the height parameter
% after closing the relevant beamercolorbox
\newcommand{\basicfooter}[2]{%
  \leavevmode
  \begin{beamercolorbox}[sep=0pt, wd=\myleftmargin, ht=#1, dp=1ex]{footline}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[sep=0pt, wd=\mytextlength, ht=#1, dp=1ex]{footline}
    \parbox{\linewidth}%
    % Don't ask me why I had to insert a space/character after \usebeamercolor
    % for it to have an effect on \hrule. Same goes for \color{white} \hrule
    { \usebeamercolor[fg]{normal text}\ \hrule }
    \leavevmode%
    #2%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[sep=0pt, wd=\myrightmargin, dp=1ex, ht=#1]{footline}
  \end{beamercolorbox}%
}

\defbeamertemplate*{frametitle}{pureminimalistictitle}{
  \vskip 10pt
  \leavevmode
  \begin{beamercolorbox}[sep=0ex, wd=.65\paperwidth, left]{frametitle}
    \usebeamerfont{frametitle}%
    \insertframetitle%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[sep=0pt, wd=.2\paperwidth, right]{headline}
    \logoheader
  \end{beamercolorbox}
}%

\defbeamertemplate*{footline}{pureminimalisticfooterdefault}{%
  \basicfooter{%
    \myfooterheight
  }{%
    \begin{beamercolorbox}[sep=0mm, wd=.725\mytextlength, ht=\myfooterheight]{footline}%
      \usebeamerfont{footline}%
      \vbox to\myfooterheight{%
        \vfil%
        \insertshorttitle{} $~|~$ %
        \insertshortauthor{} $\quad$%
        \insertshortsubtitle{}\par%
        \ifthenelse{\boolean{nofooterlogo}}{}{
          \showpagenum
        }
        \par%
        \vfil%
        \vfil%
      }
    \end{beamercolorbox}%
    \begin{beamercolorbox}[sep=0mm, wd=.275\mytextlength,right, ht=\myfooterheight]{footline}
      \vbox to\myfooterheight{%
        \vfil%
        \logofooter
        \vfil%
      }%
    \end{beamercolorbox}%
  }
}

\defbeamertemplate{footline}{pureminimalisticfooternologo}{%
  \basicfooter{%
    \myfooterheight
  }{%
      \vbox to\myfooterheight{%
      \vfil%
      \insertshorttitle{} $~|~$ %
      \insertshortauthor{} $\quad$%
      \insertshortsubtitle{}%
      \hfill \showpagenum%
      \par\vfil\vfil
    }
  }
}

\defbeamertemplate{footline}{pureminimalisticfooterdisable}{}

\ifthenelse{\boolean{nofooter}}{
  \setbeamertemplate{footline}[pureminimalisticfooterdisable]
}{}

\ifthenelse{\boolean{nofooterlogo}}{
  \setbeamertemplate{footline}[pureminimalisticfooternologo]
}{}

\mode<all>