如何只取消指定框架中的導覽列或標題

如何只取消指定框架中的導覽列或標題

我的 MWE 是

\documentclass[14pt]{beamer}% http://ctan.org/pkg/beamer
\let\Tiny\tiny% https://tex.stackexchange.com/q/58087/5764
\usetheme{Berkeley}
\makeatletter
\beamer@headheight=1.5\baselineskip
\makeatother
\setbeamercolor{normal text}{bg=black!10}
\title[Title]{My title}
\subtitle{Subtitle}
\author{Author}
\institute[Institute]{My institute}
\date[Date]{My date}
\logo{\color{blue!50}\scalebox{2}{\TeX}} % you can % it
\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\section{A section}
\subsection{A subsection}
\begin{frame}
  \frametitle{Frame title}
  \framesubtitle{frame subtitle}
  Some text
\end{frame}

\begin{frame}
  Some more text
\end{frame}

\section{Another section}
\subsection{Another subsection}
\begin{frame}
  picture
\end{frame}
\end{document} 

側邊欄我指的是所有東西,包括藍色條紋及其內容。

相關問題,使用plain就OK了。然而,這次我只想取消一件事,導覽列或標題。我該如何處理?

答案1

plain這裡的解決方案比使用 的選項同時抑制兩個元素的解決方案稍微複雜一些frame

代碼:

\documentclass[14pt]{beamer}
\usetheme{Berkeley}

\let\Tiny\tiny

\makeatletter
\beamer@headheight=1.5\baselineskip
\makeatother
\setbeamercolor{normal text}{bg=black!10}

\makeatletter
\let\Oldbeamerleftsidebar\beamer@leftsidebar
\newcommand\RecoverSpace{%
  \parshape 1 \dimexpr\beamer@leftmargin-\Gm@lmargin\relax \dimexpr\linewidth-\beamer@leftmargin+\Gm@lmargin\relax
}
\newcommand\SuppressSidebar{%
  \setbeamertemplate{sidebar left}{}
  \setlength\beamer@leftsidebar{0pt}%
}
\newcommand\SuppressTitle{%
  \setbeamertemplate{headline}{%
    \usebeamercolor[bg]{logo}%
    \vrule width\beamer@sidebarwidth height \beamer@headheight%
    \hskip-\beamer@sidebarwidth%
    \hbox to \beamer@sidebarwidth{\hss\vbox to
    \beamer@headheight{\vss\hbox{\color{fg}\insertlogo}\vss}\hss}%
  }%
}
\newcommand\RecoverVSpace{%
  \vskip-\dimexpr\beamer@headheight+2.5ex\relax%
}
\makeatother

\title[Title]{My title}
\subtitle{Subtitle}
\author{Author}
\institute[Institute]{My institute}
\date[Date]{My date}
\logo{\color{blue!50}\scalebox{2}{\TeX}} % you can % it

\begin{document}

\begin{frame}
\titlepage
\end{frame}

\section{A section}
\subsection{A subsection}
\begin{frame}
\frametitle{Frame title}
\framesubtitle{frame subtitle}
A regular frame
\end{frame}

\begingroup
\SuppressSidebar
\begin{frame}
\frametitle{Frame title}
\framesubtitle{frame subtitle}
\RecoverSpace
Some text and some more text and some more text and some more text and some more text and some more text and some more text and some more text and some more text and some more text and some more text

\RecoverSpace
Some more text
\end{frame}
\endgroup

\begin{frame}
\frametitle{Frame title}
\framesubtitle{frame subtitle}
Another regular frame
\end{frame}

\section{Another section}
\subsection{Another subsection}
\begingroup
\SuppressTitle
\begin{frame}
\RecoverVSpace
Some text and some more text and some more text and some more text and some more text and some more text and some more text and some more text and some more text and some more text and some more text
\end{frame}
\endgroup

\begin{frame}
\frametitle{Frame title}
\framesubtitle{frame subtitle}
Another regular frame
\end{frame}

\end{document}

在此輸入影像描述

備註及解釋

僅抑制側邊欄涉及許多操作:

  1. 抑制側邊欄(導覽列)上的資訊。

  2. 實際上抑制了側邊欄

  3. 重新獲得側邊欄所佔據的空間。

也許更複雜的操作是第三個,因為側邊欄的額外間距是全域設定的,\setbeamersize只能在序言中使用。我使用了一些\parshape設定來定義\RecoverSpace重新獲得空間的命令;由於\parshape僅影響當前段落,\RecoverSpace因此必須應用於修改框架中的每個段落。

對於操作一和操作二,我定義了一個\SuppressSidebar指令。

一般來說,對於要抑制側邊欄的框架,您需要執行以下操作:

\begingroup
\SuppressSidebar
\begin{frame}
\RecoverSpace
contents
\end{frame}
\endgroup

僅抑制標題還涉及許多操作:將headlineframetitle模板設為空,以及恢復分配給headline模板的垂直空間。這些操作是使用\SuppressTitle\RecoverVspace命令完成的。

一般來說,對於要隱藏標題的框架,您需要執行以下操作:

\begingroup
\SuppressTitle
\begin{frame}
\RecoverVSpace
contents
\end{frame}
\endgroup

相關內容