
我在投影機中使用 AnnArbor 模板,如下所示:
\mode<presentation>
{
\usetheme{AnnArbor}
\usecolortheme[named=kugreen]{structure}
\useinnertheme{circles}
\usefonttheme[onlymath]{serif}
\setbeamercovered{transparent}
\setbeamertemplate{blocks}[rounded][shadow=true]
}
我想在一些幻燈片中添加一條信息,該信息應顯示在頂部水平區域的右邊緣,如以下屏幕截圖中的箭頭所示:
這個資訊應該屬於每個框架(它不是在序言中一勞永逸地定義的全域標識),事實上我想為框架的內容添加參考書目,所以每個框架或空白可能會有所不同。
我需要重新定義什麼才能得到這個?
添加:傑西奈特要求提供一個最小的工作示例,那就是
\begin{frame}[fragile]
\frametitle{Phonèmes}\infoForRightCorner{Cat01}
Contents of the slide
\end{frame}
其中「Cat01」應出現在該投影片的右上角(與部分標題「Phonétique / phonologie」相同的高度和字體大小,您可以在頂部水平欄的藍色部分中看到)。這應該提醒您,這張投影片的主要參考書目是“Cat01”,即 JC Catford,語音學實用入門,牛津大學出版社 2001 年。
\begin{frame}[fragile,topbarright={Cat01}]
\frametitle{Phonèmes}
Contents of the slide
\end{frame}
但對我來說,結果比獲得它的語法更重要。
答案1
使用infolines
標題定義(請參閱beamerouterthemeinfolines.sty
),您可以重新定義標題,使右上角的框為空。然後,您可以定義一個選項myinfo
,如果傳遞到框架,將重新定義標題,以便內容myinfo
顯示在右上角的框中。
\documentclass{beamer}
\mode<presentation>
{
\usetheme{AnnArbor}
\useinnertheme{circles}
\usefonttheme[onlymath]{serif}
\setbeamercovered{transparent}
\setbeamertemplate{blocks}[rounded][shadow=true]
}
%% Make top right box blank for each new frame
\makeatletter
\BeforeBeginEnvironment{frame}{%
\setbeamertemplate{headline}{%
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,right]{section in head/foot}%
\usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,right]{subsection in head/foot}%
\usebeamerfont{subsection in head/foot}
% \insertsubsectionhead
\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}}
%% If myinfo option is passed to frame, add to headline
\define@key{beamerframe}{myinfo}[true]{%
\setbeamertemplate{headline}{%
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,right]{section in head/foot}%
\usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,right]{subsection in head/foot}%
\usebeamerfont{subsection in head/foot}
#1
% \insertsubsectionhead
\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}}
\makeatother
\begin{document}
\section{Phonétique / phonologie}
\subsection{First subsection title}
\begin{frame}[fragile,myinfo=Cat01 or something]
\frametitle{Phonèmes}
Slide with info
\end{frame}
\begin{frame}
\frametitle{Next frame}
No info for this slide
\end{frame}
\end{document}
答案2
這是使用 Tikz 的解決方案:將一個節點放置在north east
頁面的右上角(技術上:)。其他一些選項在這裡:如何將影像放置在投影機中的任意位置?
[注意:在下面的例子中,我必須發明顏色kugreen
。如果您將來能夠提供一個最小的工作範例,這意味著其他使用者可以複製貼上並立即編譯的 TeX 檔案的內容,而無需添加等等,那將會很有幫助\documentclass{...}
。
\documentclass{beamer}
\usepackage{tikz}
\definecolor{kugreen}{RGB}{50,93,61}
\mode<presentation>
{
\usetheme{AnnArbor}
\usecolortheme[named=kugreen]{structure}
\useinnertheme{circles}
\usefonttheme[onlymath]{serif}
\setbeamercovered{transparent}
\setbeamertemplate{blocks}[rounded][shadow=true]
}
\newcommand{\infoForRightCorner}[1]{%
\tikz[remember picture,overlay]{
\node[anchor=north east] at (current page.north east) {#1};}
}
\begin{document}
\begin{frame}[fragile]
\frametitle{Phonèmes}
\infoForRightCorner{Cat01}
Contents of the slide
\end{frame}
\end{document}