代码

代码

我正在尝试使用 更改演示文稿subsection栏的字体大小。我发现beamerWarsaw这与 的作用完全相同Berlin。我在演示文稿中尝试过,Warsaw但出现错误:

/usr/share/texlive/texmf-dist/tex/latex/beamer/themes/theme/beamerthemeDarmsta
dt.sty
(/usr/share/texlive/texmf-dist/tex/latex/beamer/themes/outer/beamerouterthemesm
oothbars.sty)) (/usr/share/texlive/texmf-dist/tex/latex/lipsum/lipsum.sty)

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.32 }

对我来说没什么见解。我放上我的最小代码(使用 Berlin),来展示我想用 Warsaw 实现什么。我只想subsection headerbar用 Warsaw实现更大的功能

\documentclass[10pt,a4paper,xcolor=dvipsnames,xcolor=table]{beamer}
\mode<presentation>
{\usetheme{Berlin} \setbeamercovered{transparent}}
\usetheme{Darmstadt}
\usepackage{lipsum}
\setbeamerfont*{section in head/foot}{size=\large}
\setbeamerfont*{subsection in head/foot}{size=\large}

\newlength\SubHt
\settoheight\SubHt{\usebeamerfont{subsection in head/foot}S}
\newlength\SubDh
\settodepth\SubDh{\usebeamerfont{subsection in head/foot}g}

\makeatletter
\setbeamertemplate{headline}
{%
  \begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
  \end{beamercolorbox}
  \begin{beamercolorbox}{section in head/foot}
    \vskip2pt\insertnavigation{\paperwidth}\vskip2pt
  \end{beamercolorbox}%
  \ifbeamer@theme@subsection%
    \begin{beamercolorbox}[colsep=1.5pt]{middle separation line head}
    \end{beamercolorbox}
    \begin{beamercolorbox}[ht=1.5\SubHt,dp=1.5\SubDh,%defaults: ht=2.5ex,  dp=1.125ex
      leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
      \usebeamerfont{subsection in head/foot}\insertsubsectionhead
    \end{beamercolorbox}%
  \fi%
  \begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
  \end{beamercolorbox}
}
\makeatother

\begin{document}
  \section{sec1}
  \subsection{sss}
\begin{frame}
  \frametitle{}
  \lipsum
\end{frame}
\end{document}

答案1

Warsaw使用shadow外部主题,而外部主题又基于split;而Berlin使用miniframes外部主题。

为了得到你想要的东西,你只需要看看当地的texmf树木,

TEXMF/tex/latex/beamer/base/themes/outer/

找到beamerouterthemesplit.sty文件,复制 的定义headline。然后对高度和深度进行适当的更改。

代码

\documentclass[10pt,a4paper,xcolor=dvipsnames,xcolor=table]{beamer}
\mode<presentation>
{\usetheme{Warsaw} \setbeamercovered{transparent}}
% \usetheme{Darmstadt}
\usepackage{lipsum}
\setbeamerfont*{section in head/foot}{size=\large}
\setbeamerfont*{subsection in head/foot}{size=\large}

\newlength\SubHt
\settoheight\SubHt{\usebeamerfont{subsection in head/foot}S}
\newlength\SubDh
\settodepth\SubDh{\usebeamerfont{subsection in head/foot}g}

\makeatletter
\setbeamertemplate{headline}
{%
  \leavevmode%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=1.5\SubHt,dp=1.5\SubDh]{section in head/foot}%
    \insertsectionnavigationhorizontal{.5\paperwidth}{\hskip0pt plus1filll}{}%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=1.5\SubHt,dp=1.5\SubDh]{subsection in head/foot}%
    \insertsubsectionnavigationhorizontal{.5\paperwidth}{}{\hskip0pt plus1filll}%
  \end{beamercolorbox}%
}
\makeatother

\begin{document}
  \section{sec1}
  \subsection{sss}
\begin{frame}
  \frametitle{}
  \lipsum[1]
\end{frame}
\end{document}

输出

在此处输入图片描述

答案2

您可以更改 beamerfont headline

代码

\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{lipsum}
\setbeamerfont{headline}{size=\large}

\begin{document}
  \section{sec1}
  \subsection{sss}
\begin{frame}
  \frametitle{}
  \lipsum[1]
\end{frame}
\end{document}

输出

在此处输入图片描述

相关内容