% ============================================================
% beamertheme-niederrhein.sty
% Generic beamer theme in the style of Hochschule Niederrhein /
% Wirtschaftsingenieurwesen. Defines the slide types: title slide,
% section-divider slide, ordinary content slides with a source-
% citation line, and image slides with two, three or four images
% (each with one shared caption).
%
% Everything (house colors, a generic placeholder logo including
% optional LuaLaTeX embedding) is contained in this single file --
% no separate support package needed.
%
% The placeholder logo shipped with this package (hsnr-logo.png, and
% the matching embedded Base64 data below) is a generic graphic
% created for this package and released under the same license as
% the rest of the Work; it does not depict any institution's actual
% logo or mark. Institutions wishing to use their own real logo can
% replace hsnr-logo.png and re-embed it for LuaLaTeX, see the
% documentation (beamertheme-niederrhein-doc.pdf).
%
% Copyright 2026 Alexander Rachmann
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   https://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status 'maintained'.
%
% The Current Maintainer of this work is Alexander Rachmann
% (alexander.rachmann@hs-niederrhein.de).
%
% This work consists of the file beamertheme-niederrhein.sty and
% the image file hsnr-logo.png.
% ============================================================

\NeedsTeXFormat{LaTeX2e}

% Theme version. Printable with \themeversion (e.g. on a slide or in
% the footline), e.g. \themeversion\ or Version~\themeversion.
\newcommand{\themeversion}{1.5}
\newcommand{\version}{\themeversion}

\ProvidesPackage{beamertheme-niederrhein}[2026/11/02 v1.5 Generic Niederrhein-style Beamer Theme]

% -----------------------------------------------------------
% House colors and logo (embedded directly, no external support
% package needed). Compiled with LuaLaTeX, the logo is generated
% automatically (no external hsnr-logo.png needed); with
% pdflatex/xelatex, an hsnr-logo.png is expected in the project
% directory.
% -----------------------------------------------------------
\RequirePackage{xcolor}
\RequirePackage{graphicx}
\DeclareGraphicsRule{.svg}{pdf}{.pdf}{}
\RequirePackage[
  backend=bibtex8,
  style=authoryear,
  citestyle=authoryear,
  sorting=nyt,
  natbib=true
]{biblatex}
\addbibresource{hsnr-literatur.bib}

% -----------------------------------------------------------
% Colors
% -----------------------------------------------------------
\definecolor{themedarkblue}{RGB}{41,80,140}
\definecolor{themelightblue}{RGB}{72,159,220}

% -----------------------------------------------------------
% Logo
% By default a file "hsnr-logo.png" is expected next to your own
% .tex file (changeable via \logofile{...}, e.g. \logofile{mylogo}).
% The path is resolved relative to the main document, not to this
% file, since \includegraphics always resolves paths relative to
% the compiled main document.
%
% Compiled with LUALATEX, the logo is additionally embedded directly
% in this package (Base64) and is written out automatically while
% compiling as a file "<jobname>-logo-embedded.png" -- then NO
% hsnr-logo.png needs to be shipped alongside. With pdflatex/xelatex
% the external hsnr-logo.png is still required.
%
% The logo shipped here (hsnr-logo.png and the embedded Base64 data
% below) is a generic placeholder graphic, not a real institutional
% logo -- see the license notice at the top of this file.
% -----------------------------------------------------------
\newcommand{\logofile}[1]{\renewcommand{\@logofile}{#1}}
\newcommand{\@logofile}{hsnr-logo}

\ifdefined\directlua
  % --- Base64-encoded logo (LuaLaTeX only) ----------------------
  % Note: if the document additionally loads babel with German
  % shorthand characters (e.g. "~ or "|), individual characters such
  % as "~" may become active (macros instead of literal characters).
  % The \directlua call below therefore runs inside a group with
  % reset catcodes, so the embedded Lua code is guaranteed to arrive
  % unchanged.
  \gdef\logodata{}
  \g@addto@macro\logodata{iVBORw0KGgoAAAANSUhEUgAAAjAAAACMCAYAAABiZpNIAAAPl0lEQVR4Xu3deaxtV0HH8d+rlUkFBxwgGCIVkGWKigiK1igWbRWt}
  \g@addto@macro\logodata{SzSIVCmWmljBaWsk4IBaohCXok1FodiHMqmRTa1QZkPiRBiVuh1oDaikIgpSASkOz/wu+77cd9/Z0xn2Weuc7yd5/7wz7H3W2vfs}
  \g@addto@macro\logodata{31njiVOnTil3Iab8T3JmTV2dmPmQAABk40SuAYbQMh5hBgCwb87J8QMTXqahvAAA+yarFhhuxKujNQYAsA+yaYEhvKwH5QgA2AdZ}
  \g@addto@macro\logodata{BBhuuutFeQIAdl0WAQYAAGCKrQcYWgs2g3IFAOyyrQYYbrKbRfkCAHbVVgMMAADAMggwAACgOFsLMHRvzINyBgDsoq0FGAAAgGUR}
  \g@addto@macro\logodata{YAAAQHEIMAAAoDgEGAAAUBwCDAAAKA4BBgAAFIcAAwAAikOAAQAAxTl3yhlffPKWU1OeDwAAsAmDAYbQAgAActPbhUR4AQAAOVrY}
  \g@addto@macro\logodata{AkNwAQAAOTurBYbwAgAAcndGgCG8AACAEjCNGgAAFOd0gKH1BQAAlOIgwBBeAABASehCAgAAxSHAAACA4pxD9xEAACgNLTAAAKA4}
  \g@addto@macro\logodata{BBgAAFAcAgwAACgOAQYAABSHAAMAAIpDgAEAAMUhwAAAgOIQYAAAQHEIMAAAoDgEGAAAUBwCDAAAKA4BBgAAFIcAAwAAikOAAQAA}
  \g@addto@macro\logodata{xSHAAACA4hBgAABAcQgwAACgOAQYAABQHAIMAAAoDgEGAAAUhwADAACKc25xZ4zihJg+X9I7e078vU1dfU5xHwzIDH9r2Ce0wAAA}
  \g@addto@macro\logodata{gOIQYAAAQHHoQgKALQgxPUHSc3sO/cKmri7dwqkBRaAFBgAAFIcAAwAAikOAAQAAxSHAAACA4hBgAABAcZiFhOyEmO4s6RslfYek}
  \g@addto@macro\logodata{L5R0T0l3kXSrpJslvUzS7zd19b5VTz7EdELSQyVd0P77PEmfIenTJf2PpH+T9K+S3iTpjyW9tqmr/5h63BDTJ0vygn5H//lYn9ke}
  \g@addto@macro\logodata{71Mk3UHSJ0r6iKT/lHRb+3n/qj3+jU1dfXTqsacIMXlBwcslXSzpAZLuKulD7UKEr5V0bVNX/9D1niGmIOkySQ+XdF9Jrsv3S/pn}
  \g@addto@macro\logodata{Sa+T9KKmrv5yyjktMle9TdGek6/bR0t6iKR7tXX6L5KuaurqOVPebw4hpk+Q9LXtOX9Z+7d2t/a6f5ek10j6naaubln1fDKtM673}
  \g@addto@macro\logodata{gp246LqbT23j/N99ve9BmENTV75Jb82U1UFDTI+X9Iz2xt7HN9WfknR1U1f/O/XDhZjuKOm7Jf2YpPtPeL2DxTWSfnlKgAox3dSG}
  \g@addto@macro\logodata{sVU40LzEn7upK4eqQSGmL5b0tp4nHqyC3N5cfqAte4fFLg51V0n6uaauTn93hJgc+J4lydN++643v+b5kq5s6uq/Bj/AMXPW28Tr}
  \g@addto@macro\logodata{9gt8o5f04I7P5Gva4btv2vRUH2zq6lOPvmjiOV8k6Vcl3W/gwP/dPu/Juf+tcb2fttT3VGnoQkIWQkznhpiuk/RbI8KLuUXjV9wa}
  \g@addto@macro\logodata{E2Jyy8VobSvBW9qbyZTwYm4pebKkJsT0daMPuh5uDfk+SX8TYorreUsdlL2kP3AYbFu6+vi5T3MLWPvr3a/3DfDNbSAcCst+3C00}
  \g@addto@macro\logodata{rw4x9QWls+RabyGmr5D0Fz3hxYbKZTYOqyGmX5R044jwYm4VdND/3RDTpHtGjnXG9b47Jl2MwIb4y/1ke2Ob6pG++Y79Yg0xXdJ2}
  \g@addto@macro\logodata{x7hrahV3l/SqENP3r/ImS3Jrh28mFy75+qNc9s+TNDUQPco3tRCTu/fcNeTusCm+StIvjH1BrvUWYvLnvkE66HYpgevbXVk/scTJ}
  \g@addto@macro\logodata{us5/cOzrMq0zrvcdQoBBDj5L0mNXOBGHmB8een2IyWNdXjyilWEsjx+4OsTk8SJz86/iF4aYPmnFA7vsv2fJ9/jZ9ubtsR7LeFLb}
  \g@addto@macro\logodata{etMr43rzzdDdYR4zNSSXFhjXt1cAXtZVISa3BJZaZ1zvO4QAg13hL9bOVoAQk8cKXN8OKu3y3iNjYu7UDmB1N9ErewrJIeYlIabP}
  \g@addto@macro\logodata{HlmQH2tbLJ4iya1BHjvhL1UPdnUo8Xm6dcjjc14x8J5+ncetbIvHET1ohYP7pn5F3+szqrdFXP4e/L1PHJi/q+A6W8W+X+/ZYRYS}
  \g@addto@macro\logodata{cvN6Sb/UjinwbJx7S/r2dtyJx590cQBw8/aPdDzhxyX1hYx3SLrw2ODY26WD83l9iMmDHbuaz/2L1IHkh3rO7+8k/Xo7o8MD7Lp8}
  \g@addto@macro\logodata{UDr410h6QYjpynbQcBffTJ65pkp8gQcne4xN2yXyuLabZ+wPnTe042M8HsbfLd82YlzNN0kHddNl2/U2lgeSuyvuRZI8YPvD7Swk}
  \g@addto@macro\logodata{zzrzZ3Sd5sb17PFMnl3na/KLPDhb0tcPnKhnWv3GDtQZ13vhmIW0BwqYhXTo2U1d+YZ9lhDT+dLBDfLTFj3e8k3ink1dOficFmLy}
  \g@addto@macro\logodata{a/5JOvj1uIhbRc5v6urvu967HbDqL3xPDV7EYedeTV152vVahZgcfrpminhWz92buvJU5UXlNjQL6dDTm7r6yeNvEGLyeIneVpKW}
  \g@addto@macro\logodata{B4R+8/FZKiMC2P85LDV15VllZ9h2vY2Y0XPI193FTV39+ZSK38RmjhPO2X9LFx2flt9e554u/zU9n+XWpq489mnR9bbVv7URs5C4}
  \g@addto@macro\logodata{3jf0PbUNY39ZAZvm8NA5jqWpK7eQePZPHw+k/MoFT/Avyr6xIi/tCy/W3pj9i62Lm5eHfrkuqzNYtbNbHrjsG7feKelnOt7jDzv+}
  \g@addto@macro\logodata{/yiHtys6pti6zDz1uou/g7q6/kqpt0unhpctc2vLdy5aU6itQ7fC9blHu1bTIiXUGdf7jqALCbm4pqkrt4T08YBJd5f0zfh4WLv4}
  \g@addto@macro\logodata{1lFDwaJvjMtRfztwfo9ouxB6teM6vAaHBxV7Gvd57WdyyPLU4qk/LMYMIu3znJ71PYY+s93Q1NV7Fh2gqavbQkxeEM1dKV3OWMvk}
  \g@addto@macro\logodata{iKzqrcPrmrr6o64HM/W8pq68uF6XvnWDDrnOFq3jU0Kdcb1/vKuzeAQY5OLVQyfS1NXtIaY/accUdHE//nFfOvDeJ0NMnsa9qt6p}
  \g@addto@macro\logodata{2SEmP+4xBt/SjhFZF0+rXoVXW+0yZsG8vtebu9X6AkzX2KYs6m2AQ3Vp6oET7gs3h1xnXhk7y7+1AVzvO2LqLz1gEzwA0s26Y3gc}
  \g@addto@macro\logodata{Sp9FrRFern8OXhtmoRCTu8e8JYAHtq77h4O7r5blMTQeY9PljPFEHTzguM9Qy1rX99DW622EPxvxnNz0trA0deUuv12tM653dX9P}
  \g@addto@macro\logodata{lYYAgxzcNmGJ8qF9iBa1RnQGizVbeJwQ0xPbVYNz/Hv7cN/+Su3NzANt+3j6eZ9lA9ZW620EB+/OfaEy9ZGm7p0Fd8jbBywj9zrj}
  \g@addto@macro\logodata{eifAANnayt5erbO2NAgxfa4kL9ueqzEtLENletYMomPW3eK0bpO2ojjCwXuobHIzVFeHhkLrti1bZ1zvH980difk+IsQ++euY7cC}
  \g@addto@macro\logodata{aBd66/OBBQ+ufWrzBF5LZWi1XO/O7Od5MO+dPe396L92Ab5NWccNeB3vscg2622MoW6WHI2tq2UDTO51Nvbz91nHe5R4vWcn919G}
  \g@addto@macro\logodata{2A9ezdbrnIyZ8fKAgSL59wWPv8/rw/S87uFNXXkxr03wNgd9vFCe1xDpuxkOBaBdtc16w3Kos+VRdhPRAoNceApyrxCTx1IsWufl}
  \g@addto@macro\logodata{KLdmHDc0LXRotssqhjY5fNqI6eP3WeUECrbNesNyqLPlUXYTEWCQiytDTN4LqI/3B+paM+TQolkhrxp438dssBCGBjXe3HfsEJNb}
  \g@addto@macro\logodata{nPY1wGyz3uYwNFB26O8hR7teZ5tE2U1EgEEuvKlh5wqgIaYg6RkDJ+sl3f90wXO8xsyiRbcOPSjEdOkyBRFiukOI6fIQ0293vN57}
  \g@addto@macro\logodata{4vTp69qynx94/S7bZr3NoW9PLBvqLs3RrtfZJlF2ExFgkJMnhpheE2L6Bq9W6y6jENN9Q0zeQsD7zAwt2Hby+D5I1u4TdPXAB31u}
  \g@addto@macro\logodata{iCmOLYwQ0/1CTF5+/xZJ1/bsVfSPA+/5pK7HQ0zem+hRY89p12y53uYwtEjg+SGmp4eYznNQnuOEVrUHdbYxlN10DOJFbi70rtBL}
  \g@addto@macro\logodata{nNRHJf1az+s8lfl7e9ZAuJOkl4aYvK2AV1d9o3SwIqlnYzg4uSvIG0o+RNJXS/qSkefojfH6Vuh9XIjJu1l7iwQv0ufjPVhSNbDi}
  \g@addto@macro\logodata{8L7YVr3NwQsbekaLZ5p18S7n/udAe/w5FzR15ZWpc7PLdbZplN0EBBjsiqc2ddW5qFhTVx8IMX2rdBAoHFa6eI8i/1sX7+bshew8}
  \g@addto@macro\logodata{06qLW35Gt/7sky3W28a1+0S9pQ2sO2OX62zTKLtp6EJCDtyUvsrmYt5M71lDH6SpK4+P8YDdvvEwa9XUlZfZv2aFN/1rSZua4l2E}
  \g@addto@macro\logodata{bdTbjH5zxmPNZsfrbKMou/EIMMiBm9G9kFvXQNg+L/c4kaauRi281dTVy6SDadNvn/GDuztomR2L39F2p90247lmaUv1NofrJL1h}
  \g@addto@macro\logodata{jgPNbYfrbOMou3EIMMiC99xp6soh5gpp4WJ0x3l2z49KumTEOipnaOrKY00eKukySW9doQC8LPsN7Tlf0vU+7X5C7r7yjKLbRxzP}
  \g@addto@macro\logodata{m+m51ebLm7oaszPwXpi73ubQ7gHm3cl/b47jzW0X62wulN0wxsAgK01dXRtierF0sIKtZ+B4AOw9JN1F0q3Swbop1/sLv6mroVkc}
  \g@addto@macro\logodata{ndrQ48G6zw8xPVDSBZIe5rGS7aBdrzfjFXDd3eSw9H5J72o377upnRV109hNKNvn/XSI6dmSLm9bVu7fHsv7s3hDRL+/W2rqpq7e}
  \g@addto@macro\logodata{k1XFZGLuepuDx8JIenSI6SpJj23DtVemvtuIbSiyt4t1NhfKrt+Ji667eVP7OvR69/VuycccvK/OHMcBAGAudCEBAIDibC3A3PsS}
  \g@addto@macro\logodata{DwnAptH6AgDYRVsLMAAAAMsiwAAAgOJsNcDQjbRZdB8BAHbVVgOMEWI2g/ACANhlWw8wAAAAU2URYGiFWS9aXwAAuy6LAGOEmPUg}
  \g@addto@macro\logodata{vAAA9kFWWwkchhhW6Z2O4AIA2CfZtMAcRWvMNIQXAMC+yaoFpivE0CJzNkILAGCfZRtgusJMyW687Dw2VQQAYA2y7EICAADoQ4AB}
  \g@addto@macro\logodata{AADFIcAAAIDiEGAAAEBxCDAAAKA4BBgAAFAcAgwAACgOAQYAABTnHBZXmwflDADA+tACAwAAikOAAQAAxTkIMHRvbBblCwDAep1u}
  \g@addto@macro\logodata{geEmuxmUKwAA60cXEgAAKM4ZAYbWgvWiPAEA2IyzWmC46a4H5QgAwOacOHXqVOe7X3zylu4HsRDBBQCAzesdA8PNeBrKCwCAefS2}
  \g@addto@macro\logodata{wBxHi8zZCC0AAMxvUoABAADIQW8XEgAAQI4IMAAAoDgEGAAAUBwCDAAAKA4BBgAAFIcAAwAAikOAAQAAxSHAAACA4hBgAABAcQgw}
  \g@addto@macro\logodata{AACgOAQYAABQHAIMAAAoDgEGAAAUhwADAACKQ4ABAADFIcAAAIDiEGAAAEBxCDAAAKA4/w8jh2itIHCPIgAAAABJRU5ErkJggg==}
  \begingroup
    \catcode`\~=12 \catcode`\"=12 \catcode`\|=12 \catcode`\'=12
    \directlua{
      local function b64decode(data)
        local alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
        local out = {}
        local n = 0
        local bits, bitbuf = 0, 0
        local len = data:len()
        for i = 1, len do
          local c = data:sub(i, i)
          if c == '=' then
            do end
          else
            local idx = alphabet:find(c, 1, true)
            if idx then
              idx = idx - 1
              bitbuf = bitbuf * 64 + idx
              bits = bits + 6
              if bits >= 8 then
                bits = bits - 8
                local byte = math.floor(bitbuf / (2 ^ bits))
                bitbuf = bitbuf - byte * (2 ^ bits)
                n = n + 1
                out[n] = string.char(byte)
              end
            end
          end
        end
        return table.concat(out)
      end
      local themelogofile = tex.jobname .. '-logo-embedded.png'
      local f = io.open(themelogofile, 'wb')
      if f then
        f:write(b64decode('\logodata'))
        f:close()
      end
    }
  \endgroup
  \renewcommand{\@logofile}{\jobname-logo-embedded.png}
\fi

\newcommand{\themelogo}[1][0.20\paperwidth]{\includegraphics[width=#1]{\@logofile}}
\RequirePackage{tikz}
\RequirePackage[T1]{fontenc}
\RequirePackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

% -----------------------------------------------------------
% Basic settings
% -----------------------------------------------------------
\setbeamertemplate{navigation symbols}{}
\setbeamercolor{background canvas}{bg=white}
\setbeamercolor{normal text}{fg=themedarkblue}
\setbeamertemplate{bibliography item}{\textcolor{themedarkblue}{\textbullet}}
\setbeamercolor{bibliography entry author}{fg=themedarkblue}
\setbeamercolor{bibliography entry title}{fg=themedarkblue}
\setbeamercolor{bibliography entry location}{fg=themedarkblue}
\setbeamercolor{bibliography entry note}{fg=themedarkblue}
\AtBeginBibliography{\footnotesize\color{themedarkblue}\setlength{\bibhang}{0pt}\setlength{\leftmargin}{1.5em}\setlength{\itemindent}{0pt}\setlength{\bibitemsep}{0.8em}\raggedright\hypersetup{citecolor=themedarkblue,linkcolor=themedarkblue,urlcolor=themedarkblue}}

% -----------------------------------------------------------
% Footline fields ("Prof. Dr. Lastname -- Course Name. Slide n.")
% -----------------------------------------------------------
\newcommand{\shortauthor}[1]{\renewcommand{\@shortauthor}{#1}}
\newcommand{\@shortauthor}{Lastname}
\newcommand{\coursename}[1]{\renewcommand{\@coursename}{#1}}
\newcommand{\@coursename}{Course Name}

% -----------------------------------------------------------
% Source line: a narrow text box directly above the footline, same
% font size as the footline (\tiny). Call it anywhere in the frame,
% e.g. \sourceline{Own illustration}.
%
% \sourceline{} only remembers the text -- it is printed further
% below together with the footline, in the same tikzpicture. Only
% this way do both lines end up at exactly the same x-position: a
% separate tikzpicture at the call site inside the frame content
% would end up offset by a hair due to beamer's internal boxes,
% despite identical coordinates. The definition is deliberately
% global (\global\def), because beamer only draws the footline at
% shipout time -- i.e. after the frame (and with it a merely local
% definition) has already closed again. It is reset after output so
% it does not carry over to the next slide.
% -----------------------------------------------------------
\newcommand{\@sourceline}{}
\newcommand{\@sourcelinewidth}{0.68\paperwidth}
\newcommand{\sourceline}[2][0.68\paperwidth]{%
  \global\def\@sourcelinewidth{#1}%
  \global\def\@sourceline{#2}%
}

% -----------------------------------------------------------
% Footline + logo bottom right (for content slides)
% -----------------------------------------------------------
\setbeamertemplate{footline}{%
  % The actual content is drawn via an "overlay" and therefore
  % contributes no height of its own. So that beamer still reserves
  % space at the bottom (among other things for \sourceline{} and
  % automatic page breaks with [allowframebreaks]), invisible
  % reserved height is inserted here as well.
  \rule{0pt}{0.1\paperheight}%
  \begin{tikzpicture}[remember picture, overlay]
    \node[anchor=south west, xshift=0.07\paperwidth, yshift=0.082\paperheight,
          text=themedarkblue, font=\tiny] at (current page.south west)
          {Prof.~Dr.~\@shortauthor\ -- \@coursename.\ Slide~\insertframenumber.};
    \node[anchor=south east, xshift=-0.05\paperwidth, yshift=0.045\paperheight]
      at (current page.south east) {\themelogo};
    \ifx\@sourceline\@empty\else
      \node[anchor=south west, xshift=0.07\paperwidth, yshift=0.11\paperheight,
            text=themedarkblue, font=\tiny, text width=\@sourcelinewidth,
            align=left] at (current page.south west)
            {\@sourceline};
    \fi
  \end{tikzpicture}%
  \global\let\@sourceline\@empty
}

% -----------------------------------------------------------
% Content slide: slide title at the top, light blue, bold -- flush
% with the body text (no extra manual indentation needed, "text
% margin" below already takes care of that).
% -----------------------------------------------------------
\setbeamerfont{frametitle}{series=\bfseries, size=\Large}
\setbeamercolor{frametitle}{fg=themelightblue, bg=white}
\setbeamertemplate{frametitle}{%
  \vskip0.35cm
  \insertframetitle\par
  \vspace{0.2cm}
}

% Itemize: bullet points and text in the same house color.
\setbeamertemplate{itemize item}{\textcolor{themedarkblue}{\textbullet}}
\setbeamertemplate{itemize subitem}{\textcolor{themedarkblue}{\textendash}}
\setbeamercolor{itemize item}{fg=themedarkblue}
\setbeamercolor{itemize subitem}{fg=themedarkblue}
\setbeamercolor{itemize/enumerate body}{fg=themedarkblue}
\setbeamercolor{itemize/enumerate subbody}{fg=themedarkblue}

\setbeamersize{text margin left=0.07\paperwidth, text margin right=0.06\paperwidth}

% A plain \begin{frame}{Title} ... \end{frame} is therefore already
% a "content slide" in the intended style.

% -----------------------------------------------------------
% Title slide
% \titleslide{Title}{Subtitle}{Author}
% -----------------------------------------------------------
\newcommand{\titleslide}[3]{%
  \begin{frame}[plain]
    \begin{tikzpicture}[remember picture, overlay]
      \node[anchor=north west, xshift=0.07\paperwidth, yshift=-0.27\paperheight,
            text=themedarkblue, font=\bfseries\fontsize{32}{38}\selectfont,
            align=left, text width=0.82\paperwidth, inner sep=0pt]
            at (current page.north west) {#1};
      \node[anchor=north west, xshift=0.07\paperwidth, yshift=-0.63\paperheight,
            text=themedarkblue, font=\bfseries\large, inner sep=0pt]
            at (current page.north west) {#2};
      \node[anchor=north west, xshift=0.07\paperwidth, yshift=-0.695\paperheight,
            text=themelightblue, font=\bfseries\large, inner sep=0pt]
            at (current page.north west) {#3};
      \node[anchor=south west, xshift=0.07\paperwidth, yshift=0.038\paperheight,
            text=themedarkblue, font=\tiny] at (current page.south west)
            {Prof.~Dr.~\@shortauthor\ -- \@coursename.\ Slide~\insertframenumber.};
      \node[anchor=south east, xshift=-0.05\paperwidth, yshift=0.045\paperheight]
        at (current page.south east) {\themelogo};
    \end{tikzpicture}
  \end{frame}%
}

% -----------------------------------------------------------
% Section divider
% \sectionslide{Text}
% -----------------------------------------------------------
\newcommand{\sectionslide}[1]{%
  \begin{frame}[plain]
    \begin{tikzpicture}[remember picture, overlay]
      \fill[themelightblue] (current page.south west) rectangle (current page.north east);
      \node[anchor=center, text=white, font=\bfseries\fontsize{26}{30}\selectfont]
            at (current page.center) {#1};
    \end{tikzpicture}
  \end{frame}%
}

% -----------------------------------------------------------
% Image slides: two, three or four images plus one shared caption
% below them (no image gets its own caption -- there is exactly one
% for the whole slide). Images are included via \includegraphics and
% always keep their aspect ratio (keepaspectratio); width and height
% are constrained so that portrait images do not overflow the slide
% either.
%
% \twoimages{Title}{Image1}{Image2}{Caption}
% \threeimages{Title}{TopLeft}{TopRight}{Bottom}{Caption}
% \fourimages{Title}{TopLeft}{TopRight}{BottomLeft}{BottomRight}{Caption}
% -----------------------------------------------------------
\newcommand{\imagecaption}[1]{%
  \par\vspace{0.4cm}
  {\footnotesize\color{themedarkblue} #1\par}
}

% Two images side by side
\newcommand{\twoimages}[4]{%
  \begin{frame}{#1}
    \begin{center}
      \begin{minipage}[t]{0.47\textwidth}
        \centering
        \includegraphics[width=\linewidth, height=0.42\paperheight, keepaspectratio]{#2}
      \end{minipage}\hfill
      \begin{minipage}[t]{0.47\textwidth}
        \centering
        \includegraphics[width=\linewidth, height=0.42\paperheight, keepaspectratio]{#3}
      \end{minipage}
      \imagecaption{#4}
    \end{center}
  \end{frame}%
}

% Three images: two on top side by side, one centered below
\newcommand{\threeimages}[5]{%
  \begin{frame}{#1}
    \begin{center}
      \begin{minipage}[t]{0.47\textwidth}
        \centering
        \includegraphics[width=\linewidth, height=0.27\paperheight, keepaspectratio]{#2}
      \end{minipage}\hfill
      \begin{minipage}[t]{0.47\textwidth}
        \centering
        \includegraphics[width=\linewidth, height=0.27\paperheight, keepaspectratio]{#3}
      \end{minipage}
      \par\vspace{0.2cm}
      \begin{minipage}[t]{0.55\textwidth}
        \centering
        \includegraphics[width=\linewidth, height=0.27\paperheight, keepaspectratio]{#4}
      \end{minipage}
      \imagecaption{#5}
    \end{center}
  \end{frame}%
}

% Four images: two on top, two below (2x2 grid)
\newcommand{\fourimages}[6]{%
  \begin{frame}{#1}
    \begin{center}
      \begin{minipage}[t]{0.47\textwidth}
        \centering
        \includegraphics[width=\linewidth, height=0.27\paperheight, keepaspectratio]{#2}
      \end{minipage}\hfill
      \begin{minipage}[t]{0.47\textwidth}
        \centering
        \includegraphics[width=\linewidth, height=0.27\paperheight, keepaspectratio]{#3}
      \end{minipage}
      \par\vspace{0.2cm}
      \begin{minipage}[t]{0.47\textwidth}
        \centering
        \includegraphics[width=\linewidth, height=0.27\paperheight, keepaspectratio]{#4}
      \end{minipage}\hfill
      \begin{minipage}[t]{0.47\textwidth}
        \centering
        \includegraphics[width=\linewidth, height=0.27\paperheight, keepaspectratio]{#5}
      \end{minipage}
      \imagecaption{#6}
    \end{center}
  \end{frame}%
}

\endinput
