华沙主题每张幻灯片右上角均有徽标

华沙主题每张幻灯片右上角均有徽标

与此相关问题,我想在投影仪文档中每张幻灯片的右上角放置一个徽标。

这是我的代码:

\documentclass[10pt]{beamer}
% This is the file main.tex
\usetheme{Warsaw}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{tikz}
\setbeamertemplate{navigation symbols}{}%remove navigation symbols
\setbeamercovered{transparent}
\makeatother
%\pgfdeclareimage[height=0.45cm]{logo}{figures/ubuntu-logo32}
%\logo{\pgfuseimage{logo}}
\title{title}
\author{Name Surname}
\institute{Institute\\[\medskipamount]\includegraphics[scale=0.2]{figures/ubuntu-logo32.png}}
%\email{[email protected]}
\date{date\\ place}
\begin{document}

\begin{frame}
\titlepage
\end{frame}

\addtobeamertemplate{frametitle}{}{%
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east,yshift=-6pt] at (current page.north east) {\includegraphics[scale=0.07]{figures/ubuntu-logo32.png}};
\end{tikzpicture}
}

\frame{
\transsplitverticalin
\frametitle{Summary}\tableofcontents
}

\section{Section}
\frame{\sectionpage}
\subsection{subsection}
\frame{
\frametitle{title}
\begin{block}{title}
title
\begin{itemize}
\item {title};
\item {title};
\item {title};
\item {title};
\end{itemize}
\end{block}

\begin{alertblock}{title}
title
\begin{itemize}
\item {title};
\end{itemize}
\end{alertblock}

\begin{exampleblock}{title}
title
\begin{itemize}
\item {title};
\item {title};
\item {title};
\item {title};
\end{itemize}
\end{exampleblock}
}
\end{document}

然而,我注意到了以下问题:

1) 我必须手动选择徽标的位置,这有点烦人。 有没有自动定位徽标的方法?

2) 似乎我的代码在第一个块之前“窃取”了一些空间。这是一个特别不受欢迎的效果,因为它减少了内容的整体空间。这是带有徽标的幻灯片之间的区别:

在此处输入图片描述

以及没有标志的幻灯片:

在此处输入图片描述

如何在不删除幻灯片右上角的徽标的情况下减少第一个块上方的空间?

答案1

除了使用这种tikz方法并处理额外的垂直空间外,您还可以将徽标添加到框架标题的定义中

\documentclass[10pt]{beamer}

\usetheme{Warsaw}
\setbeamertemplate{navigation symbols}{}%remove navigation symbols

\makeatletter
\setbeamertemplate{frametitle}{%
    \nointerlineskip%
    \vskip-2pt%
    \hbox{\leavevmode
        \advance\beamer@leftmargin by -12bp%
        \advance\beamer@rightmargin by -12bp%
        \beamer@tempdim=\textwidth%
        \advance\beamer@tempdim by \beamer@leftmargin%
        \advance\beamer@tempdim by \beamer@rightmargin%
        \hskip-\Gm@lmargin\hbox{%
            \setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{.92\paperwidth}%
                    \vbox{}\vskip-.75ex%
                    \leftskip0.3cm%
                    \rightskip0.3cm plus1fil\leavevmode
                    \insertframetitle%
                    \ifx\insertframesubtitle\@empty%
                    \strut\par%
                    \else
                    \par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
                    \fi%
                    \nointerlineskip
                    \vbox{}%
                \end{minipage}%
                \hfill%
                \raisebox{.1cm}{\includegraphics[height=.5cm]{example-image}}%
                }%
                \beamer@tempdim=\ht\beamer@tempbox%
                \advance\beamer@tempdim by 2pt%
                \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\beamer@tempdim}
                    \usebeamercolor{frametitle right}
                    \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
                    \pgfusepath{clip}
                    \pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
                \end{pgfpicture}
                \hskip-\paperwidth%
                \box\beamer@tempbox%
            }%
            \hskip-\Gm@rmargin%
        }%
        \nointerlineskip
        \vskip-0.2pt
        \hbox to\textwidth{\hskip-\Gm@lmargin\pgfuseshading{beamer@topshade}\hskip-\Gm@rmargin}
        \vskip-2pt
    }
\makeatother


\begin{document}

    \frame{
        \frametitle{title}
        \begin{block}{title}
            title
            \begin{itemize}
                \item {title};
                \item {title};
                \item {title};
                \item {title};
            \end{itemize}
        \end{block}

        \begin{alertblock}{title}
            title
            \begin{itemize}
                \item {title};
            \end{itemize}
        \end{alertblock}

        \begin{exampleblock}{title}
            title
            \begin{itemize}
                \item {title};
                \item {title};
                \item {title};
                \item {title};
            \end{itemize}
        \end{exampleblock}
    }
\end{document}

在此处输入图片描述

相关内容