【问题标题】:How to add framenumber in a plain frame如何在普通框架中添加帧号
【发布时间】:2010-11-03 12:24:49
【问题描述】:

我的演示文稿中有一些框架,我想摆脱我的标准标题/脚线,因为我需要空间用于数字,我包括使用 \includegraphics。这些数字占据了整个空间。现在我想在右下角插入帧号。

注意。我使用带有自定义标题/脚线的标准主题。可以在此处找到一个最小的工作示例: http://rapidshare.com/files/429008846/Beamer.zip

这是代码:

\documentclass{beamer}
\usepackage{german}
\usepackage{graphicx}
\usepackage{color}
\usepackage{colortbl}
\usepackage{pgf}
%----------------------------------------------------------------------
%----------------------------------------------------------------------
%new color
\definecolor{Gray}{gray}{0.9}
\def\textboxcolor{Gray}
%----------------------------------------------------------------------
%----------------------------------------------------------------------
\setbeamertemplate{headline}{%
\hspace{0.01\textwidth}\begin{minipage}[t]{0.88\textwidth}
\vspace{0.1cm}
\begin{tabular}{p{0.5\textwidth}p{0.4\textwidth}p{0.1\textwidth}}
Organisation - Institution&%
&%
\includegraphics[width=1cm]{pictures/logos/logo_ohne_text.jpg}\\
\hline\\
\end{tabular}
\end{minipage}}
%----------------------------------------------------------------------
\setbeamertemplate{footline}{%
\hspace{0.01\textwidth}\begin{minipage}[t]{0.88\textwidth}%
\begin{tabular}{p{0.3\textwidth}p{0.35\textwidth}p{0.2\textwidth}p{0.1\textwidth}}%
\rowcolor[rgb]{0.8,0.8,0.8}\hline%
\raggedright\begin{minipage}{0.3cm}\includegraphics[width=0.30cm]{pictures/logos/quadrat.jpg}\end{minipage}\ \insertauthor &%
\centering \    \usebeamerfont{date in head/foot}\insertshortdate{}& &%
Seite \insertframenumber{}/\inserttotalframenumber\\
\hline\\
\end{tabular}
\end{minipage}}
%----------------------------------------------------------------------
%----------------------------------------------------------------------
\begin{document}
%----------------------------------------------------------------------
    \begin{frame}{Normal Frame}
      \begin{block}{Blocktitle}
        Text
      \end{block}
    \end{frame}
%----------------------------------------------------------------------
    \begin{frame}[plain]{Frame with Images}
       \begin{center}
            \includegraphics[height=0.5\textheight]{pictures/cf.png}
            \includegraphics[height=0.5\textheight]{pictures/cf.png}\\
            \includegraphics[height=0.5\textheight]{pictures/cf.png}
            \includegraphics[height=0.5\textheight]{pictures/cf.png}
        \end{center}
        \begin{pgfpicture}{0}{0}{12.8cm}{9.6cm}
            \pgfputat{\pgfxy(10.62,1.05)}{\pgfbox[left,base]{ %
              \tiny{\insertframenumber{}/\inserttotalframenumber}}}
        \end{pgfpicture}
    \end{frame}
%----------------------------------------------------------------------
\end{document}
%----------------------------------------------------------------------
%----------------------------------------------------------------------

【问题讨论】:

标签: latex beamer


【解决方案1】:

在我最初的回答中,我要求提供一些您发布的图片。非常感谢;这些非常有帮助。


您的幻灯片看起来像是在使用 Graz 主题 [1]。我下载了它并提出了这个解决方案。试试这个(用你的版本替换我的 \usetheme{Graz},因为也许你已经修改了一点):

\documentclass{beamer}
\usepackage{pgf} % make sure you use this!
\setbeamertemplate{navigation symbols}{}
\usetheme{Graz}

\pgfdeclareimage[height=0.5cm]{university-logo}{images/uni_logo}
\logo{\pgfuseimage{university-logo}}

\begin{document}

\begin{frame}[plain]{Test slide}
  \begin{pgfpicture}{0}{0}{12.8cm}{9.6cm} % see Note 1

    \pgfputat{\pgfxy(10.62,1.05)}{\pgfbox[left,base]{ % see Note 2
              \tiny{\insertframenumber{}/\inserttotalframenumber}}}

   \pgfputat{\pgfxy(0.4,1.1)}{\pgfimage[width=0.95\textwidth]{figure}} % see Note 3

  \end{pgfpicture}
\end{frame}

\end{document}

注意1:如果你不熟悉pgf[2],语法是:

\begin{pgfpicture}{start x}{start y}{end x}{end y}

因此,您可能只需要一张带有 {0}{0}{12.8}{1.05} 的 pgf 图片就可以侥幸逃脱,它会填满整个宽度(0 -> 12.8 厘米 x 宽度),并为您提供足够的页脚页码(0 -> 1.05cm y 高度)。

但是,如果您离开它,您也可以使用 pgf 来放置图像。由你决定。将其保留为整个框架的大小不会影响任何内容。

注意 2:随意更改这些坐标。您可以在默认幻灯片和这张幻灯片之间来回切换以调整这些坐标,直到两者之间的页面 #/tot 页面列表没有明显差异。

需要注意的是,如果您开始在框架中添加文本和您拥有的内容,那么 pgfbox 的放置位置可能会出现轻微错误。如果它这样做了,只需将您的框架与数字一起获得您喜欢的位置,然后重做 \pfgputat 的坐标以将其放置在您想要的位置。

注意 3: 我从您上面的链接中截取了数字,并使用 pgf 将其放置在我的框架中。你的标题是左对齐的,而我的标题是默认居中的,但总的来说希望这看起来像你想要的(上面的 LaTeX 命令生成了这个):IMAGE。

就像我说的,只需调整各种坐标即可获得所需的一切。


11/5 更新:

正如我在注释 2 中所建议的,在框架中添加东西可能会弄乱位置。我查看了您更新的代码并让 pgf 玩得很好。它可能应该被认为是“黑客”,因为它所做的只是克服由 \includegraphics 命令引起的降档。本质上,看起来 pgfbox 不能驻留在使用此方法放置图形的位置,因此您必须在幻灯片的高处“人为”创建一个框以强制它出现......但这有效!我实际上对其进行了调整,以便如果您进入全屏模式,第一张幻灯片上的“Seite 1/2”和第二张幻灯片上的“2/2”之间应该没有任何变化。这里是:

\begin{pgfpicture}{0}{0}{12.8cm}{9.6cm}
    \pgfputat{\pgfxy(10.585,9.74)}{\pgfbox[left,base]{ %
      \tiny{\insertframenumber{}/\inserttotalframenumber}}}
\end{pgfpicture}

让我知道这是怎么回事!


[1] 万维网。 IST .图格拉兹在/员工/weiglhofer/misc/tugbeamer/

[2] 关于 ctan 的 PGF 手册: www 。棕褐色org/tex-archive/graphics/pgf 在 base/doc 中

【讨论】:

  • 我在我的问题中添加了一些链接,我希望现在更清楚,我想要什么。基本上,我想在右下角的那张幻灯片中添加帧号。我正在寻找的是一个带有帧号的文本框,我可以将其放在右下角。
  • 现在下载那个主题(我很熟悉),这样我就可以使用相同的主题,并会尽快为您提供解决方案。
  • 重新阅读我的解决方案——我将其编辑为我认为适合您的内容。
  • Hendy,谢谢你到目前为止的帮助,我现在明白你的意思了,我不知道 pgf 包,我很惊讶地看到,我可以用它添加文本框。因为我可以在我想要的地方放置一个文本框,所以这对我来说似乎是一个很好的解决方案。但我注意到,它不能很好地与 \includegraphics 命令一起使用。基本上我使用标准主题,但用格拉茨主题覆盖标题和脚注。我现在添加了我的代码的最小示例并上传了一个工作示例。在这个例子中,pgfbox 被数字向下移动了,所以它没有被显示出来。
  • 我看到我可以使用 pgf 命令来添加我的数字,但我想保留 \includegraphics 命令,因为我熟悉它。
【解决方案2】:

另一种方法可能是临时使用另一个层来显示帧号,例如导航符号。这还有一个额外的优势,即该层呈现在帧内容的顶部,因此即使对于全屏图像也是可见的。

\documentclass[xcolor={table}]{beamer}

\usepackage{pgf}

%new color
\definecolor{Gray}{gray}{0.9}
\def\textboxcolor{Gray}
%----------------------------------------------------------------------
%----------------------------------------------------------------------
\setbeamertemplate{headline}{%
\hspace{0.01\textwidth}\begin{minipage}[t]{0.88\textwidth}
\vspace{0.1cm}
\begin{tabular}{p{0.5\textwidth}p{0.4\textwidth}p{0.1\textwidth}}
Organisation - Institution&%
&%
\includegraphics[width=1cm]{example-image-duck}\\
\hline\\
\end{tabular}
\end{minipage}}
%%----------------------------------------------------------------------
\setbeamertemplate{footline}{%
\hspace{0.01\textwidth}\begin{minipage}[t]{0.88\textwidth}%
\begin{tabular}{p{0.3\textwidth}p{0.35\textwidth}p{0.2\textwidth}p{0.1\textwidth}}%
\rowcolor[rgb]{0.8,0.8,0.8}\hline%
\raggedright\begin{minipage}{0.3cm}\includegraphics[width=0.30cm]{example-image}\end{minipage}\ \insertauthor &%
\centering \    \usebeamerfont{date in head/foot}\insertshortdate{}& &%
Seite \insertframenumber{}/\inserttotalframenumber\\
\hline\\
\end{tabular}
\end{minipage}}

\begin{document}

\begin{frame}{Normal Frame}
    \begin{block}{Blocktitle}
    Text
  \end{block}
\end{frame}

\begingroup
    \setbeamertemplate{navigation symbols}{%
        \color{black}%
      \tiny%
      \setbeamertemplate{page number in head/foot}[totalpagenumber]%
      \usebeamertemplate{page number in head/foot}%
    }
    \begin{frame}[plain]{Frame with Images}
        \centering
        \includegraphics[height=0.5\textheight]{example-image}%
        \includegraphics[height=0.5\textheight]{example-image}

        \includegraphics[height=0.5\textheight]{example-image}%
        \includegraphics[height=0.5\textheight]{example-image}
    \end{frame}
\endgroup

\end{document}

【讨论】:

    【解决方案3】:

    我为此使用了一个简单的解决方案:

    \setbeamertemplate{navigation symbols}{\footnotesize\insertframenumber{} / \insertmainframenumber}
    

    它将导航符号栏替换为您的帧数。它出现在每一帧的右下角(不仅仅是[普通]帧)。

    【讨论】:

      猜你喜欢
      • 2012-10-02
      • 2023-03-12
      • 2019-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-24
      相关资源
      最近更新 更多