如何让 Beamer 侧边栏中的图片下方显示文字?

如何让 Beamer 侧边栏中的图片下方显示文字?

这是一个简单的 beamer 演示:

\documentclass{beamer}
\usepackage{tikz,graphicx} 

\title{Title}
\author{My name}
\institute{My institute}

\useoutertheme[right,height=0pt,width=0.12\paperwidth]{sidebar}
\setbeamertemplate{sidebar canvas right}[horizontal shading]       [left=blue!10!white,right=white] 

\makeatletter
\addtobeamertemplate{sidebar right}{}{%
\begin{tikzpicture}[remember picture,overlay] % 
    \node[anchor=north east,xshift=0.8pt,yshift=2pt] at (current page.north east) {\includegraphics[width=0.11\paperwidth]{logo.png}};
\end{tikzpicture}
}
\makeatother

\begin{document}
\begin{frame}[plain]
\titlepage
\end{frame}

   \begin{frame}
    Frame content
    \end{frame}

\end{document}

现在logo文件覆盖了侧边栏的文字,我想让文字显示在logo下面,那么如何修改代码呢?

徽标.png

答案1

\newlength\imageheight
\settoheight\imageheight{\includegraphics[width=0.11\paperwidth]{logo.png}}

你可以得到你的徽标的高度,然后你只需要将侧边栏的内容移动这个长度:\vspace*{\imageheight}

\documentclass{beamer}
\usepackage{tikz,graphicx} 

\title{Title}
\author{My name}
\institute{My institute}

\useoutertheme[right,height=0pt,width=0.12\paperwidth]{sidebar}
\setbeamertemplate{sidebar canvas right}[horizontal shading]       [left=blue!10!white,right=white] 

\newlength\imageheight
\settoheight\imageheight{\includegraphics[width=0.11\paperwidth]{logo.png}}

\makeatletter
\setbeamertemplate{sidebar \beamer@sidebarside}
  {
    \vspace*{\imageheight}
    \beamer@tempdim=\beamer@sidebarwidth%
    \advance\beamer@tempdim by -6pt%
    {\usebeamerfont{title in sidebar}%
        \vskip1.5em%
        \hskip3pt%
        \usebeamercolor[fg]{title in sidebar}%
        \insertshorttitle[width=\beamer@tempdim,center,respectlinebreaks]\par%
        \vskip1.25em%
    }%
    {%
        \hskip3pt%
        \usebeamercolor[fg]{author in sidebar}%
        \usebeamerfont{author in sidebar}%
        \insertshortauthor[width=\beamer@tempdim,center,respectlinebreaks]\par%
        \vskip1.25em%
    }%
    \insertverticalnavigation{\beamer@sidebarwidth}%
    \vfill
    \ifx\beamer@sidebarside\beamer@lefttext%
    \else%
    \usebeamercolor{normal text}%
    \llap{\usebeamertemplate***{navigation symbols}\hskip0.1cm}%
    \vskip2pt%
    \fi%
  }%

\addtobeamertemplate{sidebar right}{}{%
    \begin{tikzpicture}[remember picture,overlay] % 
    \node[anchor=north east,xshift=0.8pt,yshift=2pt] at (current page.north east) {\includegraphics[width=0.11\paperwidth]{logo.png}};
    \end{tikzpicture}
}
\makeatother

\begin{document}
    \begin{frame}[plain]
        \titlepage
    \end{frame}

    \begin{frame}
        Frame content
    \end{frame}

\end{document}

在此处输入图片描述

相关内容