如何编辑 beamer 主题 beamerports(Klope) 以适应 16:9 的宽高比

如何编辑 beamer 主题 beamerports(Klope) 以适应 16:9 的宽高比
\documentclass[aspectratio=169]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum, lmodern}
\usetheme{Klope} % Metro or Median, or Metro, or PraterStreet, or Milano

\author{Author Name}
\title{Beamer presentation}
\institute{Pázmány Péter Catholic University}
\date{\today}

\begin{document}
\frame{\maketitle}
\begin{frame}{Table of contents}
    \tableofcontents
\end{frame}

\section{Introduction}
\begin{frame}{Itemize}
\begin{itemize}
\item Here you can see an itemization
\begin{itemize}
\item It has items
\begin{itemize}
\item The items are below each other
\end{itemize}
\end{itemize}
\end{itemize}
\end{frame}

\begin{frame}{Enumerate}
\begin{enumerate}
\item Here you can see an enumeration
\item It has items
\item The items are numbered
\end{enumerate}
\[
    f(x)=\sum_{i=0}^\infty \frac{f^{(i)}(x_0)}{i!}(x-x_0)^i
\]
\end{frame}

\begin{frame}{Theorems and environments}
\begin{theorem}[Sample theorem]
This presentation is essentially useless.
\end{theorem}
\begin{proof}
This proof is essentially incorrect.
\end{proof}
\end{frame}

\begin{frame}{Example slide with Title}
\begin{example}
Major problem.
\end{example}
\begin{solution}
Minor nuisance.
\end{solution}
\end{frame}

\begin{frame}[plain]{Plain frame with title}
\lipsum[1]
\end{frame}
\end{document} 

在此处输入图片描述

beamerthemeKlope.sty:

 \RequirePackage{tikz, xcolor, textpos}
\usetikzlibrary{shapes.geometric}
\definecolor{KlopeCedar}{rgb}{.475,.376,.271}
\definecolor{KlopeMoss}{rgb}{.682,.749,.376}
\definecolor{KlopeSand}{rgb}{1,.949,.749}
\definecolor{KlopeDriftwood}{rgb}{.749,.675,.376}

\setbeamerfont{title}{size=\LARGE, series=\bfseries}
\setbeamerfont{frametitle}{series=\bfseries}
\setbeamerfont{block title}{series=\bfseries}

\setbeamercolor{normal text}{fg=KlopeCedar}
\setbeamercolor{item}{fg=KlopeCedar}
\setbeamercolor{section in toc}{fg=KlopeCedar}
\setbeamercolor{section page}{fg=KlopeCedar}
\setbeamercolor{subtitle}{fg=KlopeCedar}
\setbeamercolor{author}{fg=KlopeCedar}
\setbeamercolor{institute}{fg=KlopeCedar}
\setbeamercolor{date}{fg=KlopeCedar}
\setbeamercolor{title}{fg=KlopeCedar}
\setbeamercolor{frametitle}{fg=KlopeSand}
\setbeamercolor{part title}{fg=KlopeCedar}
\setbeamercolor{section title}{fg=KlopeCedar}
\setbeamercolor{section name}{fg=KlopeCedar}
\setbeamercolor{section in head/foot}{fg=KlopeSand}
\setbeamercolor{block title}{fg=KlopeCedar}

\setbeamertemplate{items}[square]
\setbeamertemplate{itemize subitem}{\tikz{\coordinate[fill, shape=diamond, color=KlopeCedar, minimum size=0.2cm, inner sep=0pt];}}
\setbeamertemplate{sections/subsections in toc}[square]
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{background canvas}[vertical shading][bottom=KlopeMoss,top=KlopeSand]
\setbeamertemplate{headline}{
    \ifnum\thepage>1\relax%
        \begin{textblock*}{10cm}(1.3cm,1.2cm)
            \insertsectionnavigationhorizontal{10cm}{\hskip0pt plus1fill}{\hskip0pt plus1fill}
        \end{textblock*}
    \fi
}
\setbeamertemplate{section in head/foot shaded}{\color{KlopeCedar}\insertsectionhead}
\newcommand{\drawupperrectangles}{
    \fill[color=KlopeCedar] (0.3,8.9) rectangle (1.1,8.1);
    \fill[color=KlopeDriftwood] (0.55,8.65) rectangle (1.25,7.95);
    \fill[color=KlopeCedar] (14.9,8.9) rectangle (15.7,8.1);
    \fill[color=KlopeDriftwood] (14.75,8.65) rectangle (15.45,7.95);
}
\newcommand{\drawlowerrectangles}{
        \fill[color=KlopeCedar] (0.3,0.3) rectangle (1.1, 1.1);
        \fill[color=KlopeDriftwood] (0.55,0.55) rectangle (1.25,1.25);
        \fill[color=KlopeCedar] (14.9,0.3) rectangle (15.7, 1.1);
        \fill[color=KlopeDriftwood] (14.75,0.55) rectangle (15.45,1.25);    
}
\setbeamertemplate{background}{
      \begin{tikzpicture}
          \useasboundingbox (0,0) rectangle (\the\paperwidth,\the\paperheight);
    \ifnum\thepage>1\relax%
        \fill[color=KlopeSand] (0,0) rectangle (\the\paperwidth,\the\paperheight);
        \fill[color=KlopeMoss] (0,10) rectangle(\the\paperwidth,8);
    \else % Title page
        \drawlowerrectangles
    \fi
    \drawupperrectangles
    \end{tikzpicture}
}
\setbeamertemplate{frametitle}
{%
    \begin{beamercolorbox}[wd=12cm, center]{frametitle}
    \insertframetitle
    \end{beamercolorbox}
}
\newenvironment{xplainframe}{%
    \bgroup%
    \setbeamercolor{frametitle}{fg=KlopeCedar}
    \setbeamertemplate{background}{%
        \begin{tikzpicture}%
        \useasboundingbox (0,0) rectangle (\the\paperwidth,\the\paperheight);%
        \fill[color=KlopeSand] rectangle (\the\paperwidth,\the\paperheight);%
        \end{tikzpicture}%
    }%
    \begin{frame}[plain]%
}{  \end{frame}%
    \egroup%
}
\newcommand{\sectionframe}{{
    \setbeamertemplate{background}{
          \begin{tikzpicture}
          \useasboundingbox (0,0) rectangle (\the\paperwidth,\the\paperheight);
          \drawupperrectangles
          \drawlowerrectangles
          \end{tikzpicture}
    }
    \setbeamertemplate{headline}{}
    \frame{\sectionpage}
}}

我想要的输出

在此处输入图片描述

在此处输入图片描述

答案1

我修改了 sty 文件:

\newcommand{\drawupperrectangles}{
    \fill[color=KlopeCedar] (0.1,8.9) rectangle (0.8,8.2);
    \fill[color=KlopeDriftwood] (0.25,8.75) rectangle (0.9,8.1);
    \fill[color=KlopeCedar] (15.2,8.9) rectangle (15.9,8.2);
    \fill[color=KlopeDriftwood] (15.05,8.75) rectangle (15.7,8.1);
}
\newcommand{\drawlowerrectangles}{
        \fill[color=KlopeCedar] (0.1,0.1) rectangle (0.8, 0.8);
        \fill[color=KlopeDriftwood] (0.25,0.25) rectangle (0.9,0.9);
        \fill[color=KlopeCedar] (15.2,0.1) rectangle (15.9, 0.8);
        \fill[color=KlopeDriftwood] (15.05,0.25) rectangle (15.7,0.9);  
}

在此处输入图片描述

在此处输入图片描述

相关内容