在页脚添加图像并使用 beamer 显示页码

在页脚添加图像并使用 beamer 显示页码

我想在页脚添加一张图片,然后显示当前页数/总页数:

所以我添加了以下三行:

\setbeamertemplate{footline}[text line]{

    \includegraphics[width=\paperwidth,height=1cm]{footer}
     \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
    }

但结果是我看不到数字。

我该如何修复它?

这是我的投影仪的完整配置:

\documentclass[smaller]{beamer}

\usepackage{xcolor}
\usepackage{comment}
\usepackage{multirow}
\usepackage{colortbl}
\usepackage{xspace}
\usepackage{textpos}
\usepackage{tikz}
\usepackage{csquotes}

\usepackage{graphicx} % already used by beamer
\graphicspath{{img/}}
\DeclareGraphicsExtensions{.png,.jpg}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BEAMER CONFIGURATION - START
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\hypersetup{pdfpagemode=FullScreen}
\beamertemplatenavigationsymbolsempty

\usetheme{Singapore}    % red, quite simple
\usecolortheme{orchid}

% Make margines wider
\setbeamersize{text margin left=1em,text margin right=1em}

% Select itemization and enumeration style: default, ball, circle
% \setbeamertemplate{enumerate subitem}[default]
\setbeamertemplate{enumerate items}[square]
\setbeamertemplate{itemize items}[triangle]

%%% The navigation bar on top
\setbeamertemplate{headline}{}
% \setbeamertemplate{headline}[infolines theme]

\definecolor{UofTBlue}{RGB}{0,47,101}
\setbeamertemplate{frametitle}{%
    \nointerlineskip%
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.8ex,dp=.9ex]{frametitle}
        \hspace*{1ex}\insertframetitle%
    \end{beamercolorbox}%
}

\setbeamercolor{structure}{fg=UofTBlue}
\setbeamercolor{frametitle}{fg=white,bg=darkgreen}
\setbeamercolor{section in head/foot}{fg=white,bg=UofTBlue}



%\makeatletter
%\setbeamertemplate{footline}
%{
%  \leavevmode%
%  \hbox{%
%  \begin{beamercolorbox}[wd=1\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
%%     \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
%    \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
%  \end{beamercolorbox}
%  }%
%  \vskip0pt%
%}
%\makeatother

\setbeamertemplate{footline}[text line]{
\includegraphics[width=\paperwidth,height=1cm]{footer}
 \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
}

\end{document}

答案1

您可以使用tikz在图像顶部插入帧编号。并且您不应该使用模板,text line因为它不希望其内容占满整个文本宽度。

最小示例:

\documentclass{beamer}
\usepackage{tikz}

\setbeamertemplate{footline}{\begin{tikzpicture}
    \node [inner sep=0pt, anchor=east] (0,0) {\includegraphics[width=\paperwidth,height=1cm]{example-image}};
    \node [inner sep=0pt, anchor=east] at (-2ex,-3ex) {\insertframenumber{} / \inserttotalframenumber};
\end{tikzpicture}}

\begin{document}

\begin{frame}
    \frametitle{Test}
\end{frame}

\end{document}

在此处输入图片描述

相关内容