我正在尝试创造自己的基于此答案的 beamer 主题. 我至今的数据:
beamerthemetexsx.sty
%beamerthemetexsx.sty
\mode<presentation>
% Requirement
\RequirePackage{tikz}
\RequirePackage{xcolor}
%Colour
\definecolor{aublue}{HTML}{0A1439}
% Settings
\useinnertheme{texsx}
\useoutertheme{texsx}
\usecolortheme{texsx}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{blocks}[rounded][shadow=true]
\mode<all>
beamercolorthemetexsx.sty
%beamercolorthemetexsx.sty
\mode<presentation>
% Settings
\setbeamercolor*{title page header}{fg=white}
\setbeamercolor*{author}{fg=white}
\setbeamercolor*{date}{fg=white}
\setbeamercolor*{item}{fg=orange}
% Items
\setbeamertemplate{items}[square]
\setbeamertemplate{sections/subsections in toc}[square]
\mode
<all>
beamerouterthemetexsx.sty
%beamerouterthemetexsx.sty
\mode<presentation>
\setbeamertemplate{background}{
\begin{tikzpicture}
\useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fill[color=aublue] (0,0.75) rectangle (\the\paperwidth, 8);
\ifnum\thepage>1\relax%
\fill[white,opacity=1] (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fi
\end{tikzpicture}
}
% Title page
\defbeamertemplate*{title page}{texsx}[1][]
{
\begin{beamercolorbox}[wd=12cm,leftskip=3cm,sep=8pt,#1]{title page header}
\usebeamerfont{title}\inserttitle\par%
\end{beamercolorbox}%
\vskip0.75cm%
\begin{beamercolorbox}[wd=12cm,leftskip=3cm,#1]{author}
\usebeamerfont{author}\insertauthor%
\end{beamercolorbox}
\vskip0.2cm%
\begin{beamercolorbox}[wd=12cm,leftskip=3cm,#1]{date}
\usebeamerfont{author}\insertdate%
\end{beamercolorbox}
\vfill
}
\mode
<all>
beamerinnerthemetexsx.sty
%beamerinnerthemetexsx.sty
\mode<presentation>
% Frame title
\defbeamertemplate*{frametitle}{texsx}[1][]
{
\vskip1cm%
\begin{beamercolorbox}[wd=\paperwidth,ht=1.2cm]{frametitle}
\begin{tikzpicture}
\useasboundingbox[fill=white](0,0) rectangle(\the\paperwidth,1.2);
\fill[aublue] (0,0) rectangle(\the\paperwidth,1.5);
\ifx\insertframesubtitle\@empty%
{\node[anchor=west, white,font=\large] at (3.2,0.61){\insertframetitle};}
\else%
{\node[anchor= west, white,font=\large] at (3.2,0.81){\insertframetitle};%
\node[anchor= west, white,font=\small] at (3.2,0.41){\insertframesubtitle};}
\fi
\end{tikzpicture}
\end{beamercolorbox}
}
\mode<all>
texsx-example.tex
%texsx-example.tex
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\title{There Is No Largest Prime Number}
\date[ISPN ’80]{27th International Symposium of Prime Numbers}
\author[Euclid]{Euclid of Alexandria \texttt{[email protected]}}
\usetheme{texsx}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{There Is No Largest Prime Number}
\framesubtitle{The proof uses \textit{reductio ad absurdum}.}
\begin{theorem}
There is no largest prime number. \end{theorem}
\begin{enumerate}
\item<1-| alert@1> Suppose $p$ were the largest prime number.
\item<2-> Let $q$ be the product of the first $p$ numbers.
\item<3-> Then $q+1$ is not divisible by any of them.
\item<1-> But $q + 1$ is greater than $1$, thus divisible by some prime
number not in the first $p$ numbers.
\end{enumerate}
\end{frame}
\begin{frame}{A longer title}
\begin{itemize}
\item one
\item two
\end{itemize}
\end{frame}
\end{document}
问题
1.外
我想将大学徽标(看起来像一个正方形)放在第 1 点,将大标题放在第 2 点,将我的大学名称放在第 3 点。我尝试了很多次,但似乎所有信息都只想放在蓝色字段中。我不知道如何解决这个问题。
2.内
下一张图片:
我想将标题框稍微向上移动一点(应该还留有一些空白)。在标题框上方的空白处,我希望在点 (1) 处用黑色显示我的大学名称,用灰色显示作者姓名(全部用 | 分隔)。
其次,我希望将我的大学徽标(来自标题框)放置在点 2 处。
更多说明
我已经尽了最大的努力。如果能得到一点帮助,我会更加努力(因为这只是两个反复出现的问题)。
提前非常感谢您!
答案1
以下示例原则上应显示您提到的所有内容。我重新定义了一些元素,但现在定位非常灵活。因此,如果您希望将框架标题稍微向上移动一点,只需调整其坐标即可。
[注意:所有坐标仅大致符合我们的设计,您可能需要对其进行微调]
%texsx-example.tex
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\title{There Is No ...}
\date[ISPN ’80]{27th International Symposium of Prime Numbers}
\author[author1 \quad|\quad author2]{Euclid of Alexandria \texttt{[email protected]}}
\institute{My University}
\usetheme{texsx}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{There Is No Largest Prime Number}
\framesubtitle{The proof uses \textit{reductio ad absurdum}.}
\begin{theorem}
There is no largest prime number. \end{theorem}
\begin{enumerate}
\item<1-| alert@1> Suppose $p$ were the largest prime number.
\item<2-> Let $q$ be the product of the first $p$ numbers.
\item<3-> Then $q+1$ is not divisible by any of them.
\item<1-> But $q + 1$ is greater than $1$, thus divisible by some prime
number not in the first $p$ numbers.
\end{enumerate}
\end{frame}
\begin{frame}{A longer title}
\begin{itemize}
\item one
\item two
\end{itemize}
\end{frame}
\end{document}
%beamercolorthemetexsx.sty
\mode<presentation>
% Settings
\setbeamercolor*{title page header}{fg=white}
\setbeamercolor*{frametitle}{fg=white}
\setbeamercolor*{framesubtitle}{fg=white}
\setbeamercolor*{headline}{fg=red}
\setbeamercolor*{author}{fg=white}
\setbeamercolor*{date}{fg=white}
\setbeamercolor*{title}{fg=red}
\setbeamercolor*{institute}{fg=red}
\setbeamercolor*{item}{fg=orange}
% Items
\setbeamertemplate{items}[square]
\setbeamertemplate{sections/subsections in toc}[square]
\mode
<all>
%beamerinnerthemetexsx.sty
\mode<presentation>
% Frame title
\defbeamertemplate*{frametitle}{texsx}[1][]{
\setlength{\unitlength}{1mm}
\begin{picture}(0,0)(0,0)
%author
\put(10,2){%
\usebeamerfont{footline}
\usebeamercolor[fg]{headline}%
\ifx\insertinstitute\empty\else
\insertshortinstitute\quad|\quad
\fi
\ifx\insertauthor\empty\else
\insertshortauthor
\fi
}%
% Blue background
\put(-10,-12){\color{aublue}\rule{\paperwidth}{12mm}}
% logo
\put(-10,-12){\includegraphics[height=12mm]{pic}}
% Title
\put(10,-8){%
\begin{minipage}[c][30mm][c]{80mm}
\ifx\insertframetitle\empty\else
\usebeamerfont{frametitle}\usebeamercolor[fg]{frametitle}\insertframetitle\par%
\fi%
\ifx\insertframesubtitle\empty\else
\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\par%
\fi%
\end{minipage}
}
\end{picture}
}
\mode<all>
%beamerthemetexsx.sty
\mode<presentation>
% Requirement
\RequirePackage{tikz}
\RequirePackage{xcolor}
%Colour
\definecolor{aublue}{HTML}{0A1439}
% Settings
\useinnertheme{texsx}
\useoutertheme{texsx}
\usecolortheme{texsx}
\usefonttheme{texsx}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{blocks}[rounded][shadow=true]
\mode<all>
%beamerouterthemetexsx.sty
\mode<presentation>
% Title page
\defbeamertemplate*{title page}{texsx}[1][]
{
\setlength{\unitlength}{1mm}
\begin{picture}(0,0)(0,0)
% Blue background
\put(-10,-46.5){\color{aublue}\rule{\paperwidth}{72mm}}
% logo
\put(0,28){\includegraphics[width=.15\textwidth]{pic}}
% Title
\put(23,32){%
\begin{minipage}[c][30mm][c]{80mm}
\usebeamerfont{title}\usebeamercolor[fg]{title}\inserttitle\par%
\end{minipage}
}
% author etc
\put(23,-5){%
\begin{minipage}[c][30mm][c]{80mm}
\ifx\insertauthor\empty\else
\usebeamerfont{author}\usebeamercolor[fg]{author}\insertauthor%
\vskip0.2cm%
\fi%
\ifx\insertdate\empty\else
\usebeamerfont{author}\usebeamercolor[fg]{author}\insertdate%
\fi%
\end{minipage}
}
% author etc
\put(23,-53){%
\begin{minipage}[c][30mm][c]{80mm}
\ifx\insertinstitute\empty\else
\usebeamerfont{institute}\usebeamercolor[fg]{institute}\insertinstitute%
\fi%
\end{minipage}
}
\end{picture}
}
\mode
<all>
%beamerfontthemetexsx.sty
\mode<presentation>
\setbeamerfont{title}{series=\bfseries,size=\fontsize{18}{22}}
\setbeamerfont{footline}{size=\fontsize{6}{8}}
\mode
<all>
答案2
这是另一个解决方案,结果类似,但方法大多不同。希望这两种解决方案对构建新主题的任何人都有用。
另外,我曾经\begin{frame}[plain]\titlepage\end{frame}
把标题从标题页中删除过。
结果:
%beamerthemetexsx.sty
\mode<presentation>
% Requirement
\RequirePackage{tikz}
\RequirePackage{xcolor}
%Colour
\definecolor{aublue}{HTML}{0A1439}
%logo
\pgfdeclareimage[height=1.5cm]{Logo}{example-image-a}%Loads logo here
% Settings
\useinnertheme{texsx}
\useoutertheme{texsx}
\usecolortheme{texsx}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{blocks}[rounded][shadow=true]
\mode<all>
%beamercolorthemetexsx.sty
\mode<presentation>
% Settings
\setbeamercolor*{title page header}{fg=white}
\setbeamercolor*{author}{fg=white}
\setbeamercolor*{date}{fg=white}
\setbeamercolor*{item}{fg=orange}
%\setbeamercolor*{logo in frametitle}{bg=magenta}
\setbeamercolor*{titleframe}{bg=aublue,fg=white}
\setbeamercolor*{info in head}{bg=,fg=red}
\setbeamercolor*{title page header}{fg=cyan}
\setbeamercolor*{framesubtitle}{fg=white}
% Items
\setbeamertemplate{items}[square]
\setbeamertemplate{sections/subsections in toc}[square]
\mode
<all>
%beamerouterthemetexsx.sty
\mode<presentation>
\setbeamertemplate{background}{
\begin{tikzpicture}
\useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fill[color=aublue] (0,0.75) rectangle (\the\paperwidth,8);
\ifnum\thepage>1\relax%
\fill[white,opacity=1] (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fi
\end{tikzpicture}
}
% Title page
\defbeamertemplate*{title page}{texsx}[1][]
{\vskip5pt\leavevmode%
\begin{beamercolorbox}[wd=0cm,sep=0pt,ht=1.5cm,#1]{title page header}%
\pgfuseimage{Logo}%Inserts logo here, the logo is loaded in beamerthemetexsx.sty (so that the logo can be used both in the inner and outer theme)
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=12cm,leftskip=3cm,sep=0pt,ht=1.5cm,#1]{title page header}%
\usebeamerfont{title}\inserttitle\par%
\ifx\insertsubtitle\@empty\vskip1.5em%
\else%
\vskip0.25em%
{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
\fi%
\end{beamercolorbox}%
\vskip0.75cm%
\begin{beamercolorbox}[wd=12cm,leftskip=3cm,#1]{author}
\usebeamerfont{author}\insertauthor%
\end{beamercolorbox}
\vskip0.2cm%
\begin{beamercolorbox}[wd=12cm,leftskip=3cm,#1]{date}
\usebeamerfont{author}\insertdate%
\end{beamercolorbox}
\vskip6cm%
\begin{beamercolorbox}[wd=12cm,leftskip=3cm,#1,center%center centers the content in the box (horizontally)
]{institute}
\usebeamerfont{author}\strut\insertinstitute\strut%
\end{beamercolorbox}
}
\mode
<all>
%beamerinnerthemetexsx.sty
\mode<presentation>
\defbeamertemplate*{headline}{texsx}[1][]
{%\leavevmode%
\begin{beamercolorbox}[leftskip=.1\paperwidth,%
dp=1pt,left,#1]{info in head}%
\hspace{\Gm@lmargin}\strut|\quad\insertshortinstitute\quad|\quad\insertshortauthor\quad|\quad%
\end{beamercolorbox}%
% \vskip-1.95pt %if the background of "info in head" is set to something else than white, this line can be used to remove the whitespace
}
\defbeamertemplate*{frametitle}{texsx}[1][]
{\leavevmode%
\begin{beamercolorbox}[wd=.1\paperwidth,%INPUT SUITABLE WIDTH
ht=1.5cm,dp=0cm,#1]{logo in frametitle}%
\vbox{}\hspace*{-\Gm@lmargin}\pgfuseimage{Logo}%\Gm@lmargin is the left text margin, the logo is loaded in beamerthemetexsx.sty
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.9\paperwidth,%INPUT SUITABLE WIDTH
ht=1.5cm,dp=0cm,sep=5pt,#1]{titleframe}%dp=depth,ht=height, wd=width.
\usebeamerfont{frametitle}\strut\insertframetitle\strut\par%
\ifx\insertframesubtitle\@empty%
\else%
{\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\strut\insertframesubtitle\strut}%
\fi%
\end{beamercolorbox}%=
}
\mode<all>