开发者

How to add framenumber in a plain frame

开发者 https://www.devze.com 2023-01-23 02:06 出处:网络
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 whol

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}}
%------------------开发者_如何学JAVA----------------------------------------------------
\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}
%----------------------------------------------------------------------
%----------------------------------------------------------------------


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


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}


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消