如何在普通帧中添加帧号

发布于 2024-09-30 14:14:29 字数 2949 浏览 6 评论 0原文

我的演示文稿中有一些框架,我想在其中删除标准标题/页脚,因为我需要图形空间,我使用 \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}
%----------------------------------------------------------------------
%----------------------------------------------------------------------

I have some frames in my presentation, where I want to get rid of my standard Headline/Footline since i need the space for figures, which i include using \includegraphics. These figures take the whole space. Now i want to inset the frame number at the bottom right corner.

Note. I use the standard theme with a custom headline/footline. A working minimum example can be found here:
http://rapidshare.com/files/429008846/Beamer.zip

This is the code:

\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}
%----------------------------------------------------------------------
%----------------------------------------------------------------------

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

原谅过去的我 2024-10-07 14:14:29

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


您的幻灯片看起来像是使用 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.8cm x 宽度),然后给你足以容纳页脚页码(0 -> 1.05cm y 高度)。

但是,如果保留它,您也可以使用 pgf 来放置图像。由你决定。让它保持整个框架的大小不会产生任何影响。

注释 2:根据需要更改这些坐标。您可以在默认幻灯片和此幻灯片之间来回翻转以调整这些坐标,直到两者之间的第 #/tot 页列表中没有明显的差异。

需要注意的是,如果您开始添加文本以及框架中的内容,则 pgfbox 的位置可能会发生轻微的变化。如果这样做,只需按照您喜欢的图形方式设置框架,然后重做 \pfgputat 的坐标即可将其放置在您想要的位置。

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

就像我说的,只需调整各种坐标即可将所有内容放在您想要的位置。


更新 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] www 。是。图格拉兹。 at/staff/weiglhofer/misc/tugbeamer/

[2] ctan 上的 PGF 手册:www .克坦。 org/tex-archive/graphics/pgf 在 base/doc 中

In my original answer, I requested some pictures, which you posted. Many thanks; those were very helpful.


Your slide looks like it's using the Graz theme [1]. I downloaded that and came up with this solution. Try this (replace my \usetheme{Graz} with whatever you've called your version, as perhaps you've modified it a little):

\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}

Note 1: If you're unfamiliar with pgf[2], the syntax is:

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

So you could probably get away with just a pgf picture with {0}{0}{12.8}{1.05}, which would fill the whole width (0 -> 12.8cm x width) and just give you enough for the footer page number (0 -> 1.05cm y height).

However, if you leave it, you can use pgf to place your images as well. It's up to you. It doesn't affect anything to leave it the size of the whole frame.

Note 2: Alter these coordinates however you'd like. You can flip back and forth between a default slide and this one to tweak those coordinates until there is no discernible difference in the page #/tot pages listing between the two.

One note is that if you start adding text and what have you to the frame, there is a slight chance that the placement of the pgfbox might get knocked around. If it does this, just get your frame how you like it with the figures and redo the coordinates of \pfgputat to get it where you want.

Note 3: I took a screenshot of the figures from your link above and used pgf to place it in my frame. Your title is left aligned whereas mine is in the default centered position, but overall hopefully this looks like what you want (the LaTeX commands above generated this): IMAGE.

Like I said, just tweak the various coordinates to get everything where you want.


Update 11/5:

As I suggested in Note 2, adding things to the frame might mess up the placement. I have looked at your updated code and made pgf play nicely. It probably should be considered a "hack" since all it's doing is overcoming the downshift caused by the \includegraphics command. Essentially, it looks like pgfbox can't reside where there are graphics placed with this method so you have to create a box "artificially" high up on the slide to force it to appear... but this works! I actually tweaked it so that if you go into full screen mode, there should be no shift whatsoever between "Seite 1/2" on the first slide and "2/2" on the second. Here it is:

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

Let me know how that goes!


[1] www . ist . tugraz . at/staff/weiglhofer/misc/tugbeamer/

[2] PGF manual on ctan: www . ctan . org/tex-archive/graphics/pgf in base/doc

给我一枪 2024-10-07 14:14:29

另一种方法可以是暂时使用另一层来显示帧编号,例如导航符号。这具有额外的优点,即该层渲染在帧内容之上,因此即使对于全屏图像也可见。

\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}

Another approach could be to temporarily use another layer to display the framenumbers, e.g. the navigation symbols. This has the additional advantage, that this layer is rendered on top of the frame content and thus will be visible even for full screen images.

\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}
烈酒灼喉 2024-10-07 14:14:29

我正在使用一个简单的解决方案:

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

它用帧编号替换导航符号栏。它出现在每个帧的右下角(不仅是[普通]帧)。

I am using a simple solution for that:

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

It replaces the navigation symbols bar by your frames numbers. It appears in the right bottom corner of every frame (not only [plain] frames).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文