在 Beamer LaTeX 中自定义框架标题框

在 Beamer LaTeX 中自定义框架标题框

我有两个问题。

  1. 由于某种原因,框架标题框当前是透明的,我该如何将其重置为其默认样式?
  2. 其次,我想最小化框的高度,但这也会删除字幕。我该如何避免这种情况。

序言代码:

\documentclass[leqno, t]{beamer}

\usetheme{CambridgeUS}
\usecolortheme{whale}
\useinnertheme{rectangles}
\usefonttheme{professionalfonts}
\setbeamercovered{transparent}

\usepackage{amsthm, amsmath, amssymb, amsfonts, exscale, latexsym, float, eucal, mathtools}
\usepackage{adjustbox}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{booktabs}

\hypersetup{
    colorlinks = true,
    citecolor = blue,
    linkcolor = black
}

\setbeamertemplate{frametitle}{%
    \nointerlineskip%
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.0ex,dp=1ex]{frametitle}
        \hspace{1ex}\insertframetitle%
    \end{beamercolorbox}%
}

\makeatother
\setbeamertemplate{footline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.4\paperwidth, ht = 2.25ex, dp = 1ex, center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.6\paperwidth, ht = 2.25ex, dp = 1ex, center]{title in head/foot}%
    \usebeamerfont{title in head/foot}{Measuring the Natural Rate of Interest}\hspace*{11em}
    \insertframenumber{} / \inserttotalframenumber\hspace*{0ex}
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatletter

\setbeamertemplate{navigation symbols}{}

\usepackage[autostyle=true]{csquotes}  % Required to generate language-dependent quotes in the bibliography
\usepackage[backend=biber,style=apa, natbib=true, autocite=inline, uniquename=false]{biblatex}
\DeclareLanguageMapping{english}{english-apa}
\addbibresource{References.bib}
\def\citeapos#1{\citeauthor{#1}'s (\citeyear{#1})}

谢谢您的帮助!

答案1

  • 你不需要\usepackage{hyperref}使用投影仪

  • 主题CambridgeUS会将框架标题的颜色设为浅灰色,而鲸鱼颜色主题会将字体颜色改为白色。你可以将默认主题改为白色背景和蓝色字体,或者改为你喜欢的其他颜色

    \setbeamercolor{frametitle}{bg=white,fg=structure.fg}
    
  • 为了包含 framesubtitle,我建议对默认 frametitle 定义进行以下变化:


\documentclass[leqno, t]{beamer}

\usetheme{CambridgeUS}
\usecolortheme{whale}

%\usepackage{hyperref}

\makeatletter
\setbeamertemplate{frametitle}{%
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \begin{beamercolorbox}[sep=0.2cm,left,wd=\the\@tempdima]{frametitle}
    \usebeamerfont{frametitle}%
    \vbox{}\vskip-2ex%
    \if@tempswa\else\csname beamer@fteleft\endcsname\fi%
    \strut\insertframetitle\strut\par%
    {%
      \ifx\insertframesubtitle\@empty%
      \else%
      {\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
      \fi
    }%
    \vskip-1ex%
    \if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
  \end{beamercolorbox}%
}
\makeatother

\setbeamercolor{frametitle}{bg=white,fg=structure.fg}

\begin{document}

\begin{frame}
\frametitle{content...}
\framesubtitle{title}
\end{frame}

\end{document}

相关内容