代码之家  ›  专栏  ›  技术社区  ›  Roland

如何在普通框架中添加framenumber

  •  2
  • Roland  · 技术社区  · 15 年前

    我的演示文稿中有一些框架,我想去掉标准的标题/页脚,因为我需要数字空间,包括使用 \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}
    %----------------------------------------------------------------------
    %----------------------------------------------------------------------
    
    2 回复  |  直到 15 年前
        1
  •  2
  •   Hendy    15 年前

    在我最初的回答中,我要求一些照片,你贴了出来。非常感谢;这些都很有帮助。


    你的幻灯片看起来像是在使用Graz主题[1]。我下载了这个,并提出了这个解决方案。尝试此操作(将my\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:

    一个需要注意的是,如果你开始添加文本以及你在框架中的内容,那么 轻微的

    注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] 万维网。是的。图格拉斯。at/staff/weiglhofer/misc/tugbeamer公司/

    [2] 关于ctan的PGF手册:www。ctan公司。org/tex archive/graphics/pgf in base/doc中

        2
  •  0
  •   samcarter_is_at_topanswers.xyz    7 年前

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

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