我尝试使用 if else fi 在标题页上获取不同的标题,但它破坏了框架样式。为什么?
需要 beamertheme.sty 的帮助
\setbeamertemplate{headline}
{%
\ifnum \insertpagenumber=1
\begin{beamercolorbox}[wd=\paperwidth, ht=2mm, dp=1mm]{head1}\end{beamercolorbox}%
\else
\begin{beamercolorbox}[wd=\paperwidth, ht=2mm, dp=1mm]{head1}\end{beamercolorbox}%
\vspace*{1mm}%
\hspace{1mm}\includegraphics[width=0.1\paperwidth]{fig/logo.png}%
\vspace{1mm}%
\newline%
\begin{beamercolorbox}[wd=\paperwidth, ht=0.5mm, dp=1mm]{head1}\end{beamercolorbox}%
\fi
}
\setbeamercolor{head1}{fg=white, bg=black}
没有 if else fi
\setbeamertemplate{headline}{%
\begin{beamercolorbox}[wd=\paperwidth, ht=2mm, dp=1mm]{head1}\end{beamercolorbox}%
\vspace*{1mm}%
\hspace{1mm}\includegraphics[width=0.1\paperwidth]{fig/logo.png}%
\vspace{1mm}%
\newline%
\begin{beamercolorbox}[wd=\paperwidth, ht=0.5mm, dp=1mm]{head1}\end{beamercolorbox}%
}
\setbeamercolor{head1}{fg=white, bg=black}
更新:看起来接下来的页面与第一个标题对齐。
答案1
我发现了一个肮脏的解决方案(仅当标题页上的标题较大时才有效):
beamerthemeoooo.sty
% Head line for frames
\defbeamertemplate*{headline}{headline frames}
{%
\begin{beamercolorbox}[wd=\paperwidth, ht=3mm]{head1}\end{beamercolorbox}%
\vspace*{1mm}%
\hspace*{1mm}\includegraphics[height=8mm]{fig/logo.png}%
\vspace*{1mm}%
\newline%
\begin{beamercolorbox}[wd=\paperwidth, ht=1mm]{head1}\end{beamercolorbox}%
}
% Head line for title page
\defbeamertemplate*{headline}{headline titlepage}
{%
\begin{beamercolorbox}[wd=\paperwidth, ht=3mm]{head1}\end{beamercolorbox}%
\vspace*{1mm}
\hspace*{1mm}\includegraphics[height=30mm]{fig/logo.png}
}
\setbeamercolor{head1}{fg=white, bg=black}
beamer.tex
\setbeamertemplate{headline}[headline frames]% for whole document
\begin{document}
\setbeamertemplate{headline}[headline titlepage]% change to titlepage headline
\begin{frame}
\titlepage
\end{frame}
\setbeamertemplate{headline}[headline frames]% change back to frame headline