Beamer 中的侧边栏

Beamer 中的侧边栏

我正在使用PaloAlto主题。我想在幻灯片的侧面而不是导航侧栏上显示图像。

我试过 :

\setbeamertemplate{sidebar}{
\includegraphics[scale=0.1]{image.jpg}
}

但侧边栏仍然带有导航。我该怎么做?

答案1

首先将模板设置sidebar canvas left为空,然后使用模板包含图像sidebar left

\documentclass{beamer}
\usetheme[width=1.5cm]{PaloAlto}

\makeatletter
\setbeamertemplate{sidebar canvas left}{}
\setbeamertemplate{sidebar left}{%
  \vspace*{\fill}
  \includegraphics[width=1.5cm,height=5cm]{ctanlion}
  \vspace*{\fill}
}
\makeatother

\begin{document}

\frame{CTAN lion drawing by Duane Bibby.}

\end{document}

在此处输入图片描述

如果你还想删除左上角较暗的方块,请在序言中添加以下行

\makeatletter
\setlength\beamer@sidebarwidth{0cm}
\makeatother

现在,作为评论中的一项新要求,OP 决定他/她需要一个黑色侧边栏,中间有一个图像,底部有作者姓名。这是新代码:

\documentclass{beamer}
\newlength\mywd
\setlength\mywd{1.5cm}
\usetheme[width=\mywd]{PaloAlto}

\makeatletter
\setbeamertemplate{sidebar canvas left}[vertical shading][top=black,middle=black,bottom=black]

\setbeamertemplate{sidebar left}{%
  \vspace*{\fill}
  \includegraphics[width=\mywd,height=3cm]{ctanlion}\par
  \vfill
  \parbox{\mywd}{\centering\textcolor{white}{\insertauthor}}
  \vspace*{0.6cm}
}
\setlength\beamer@sidebarwidth{0cm}
\makeatother

\author{The Author}
\begin{document}

\frame{CTAN lion drawing by Duane Bibby.}

\end{document}

在此处输入图片描述

如果黑色条纹必须一直延伸到顶部,则需要对标题模板进行重新定义:

\documentclass{beamer}
\newlength\mywd
\setlength\mywd{1.5cm}
\usetheme[width=\mywd]{PaloAlto}

\makeatletter
\setbeamertemplate{sidebar canvas left}[vertical shading][top=black,middle=black,bottom=black]

\setbeamertemplate{sidebar left}{%
  \vspace*{\fill}
  \includegraphics[width=\mywd,height=3cm]{ctanlion}\par
  \vfill
  \parbox{\mywd}{\centering\textcolor{white}{\insertauthor}}
  \vspace*{0.6cm}
}
 \setbeamertemplate{headline}
  {%
    \begin{beamercolorbox}[wd=\paperwidth]{frametitle}
      \ifx\beamer@sidebarside\beamer@lefttext%
      \else%
        \hfill%
      \fi%
      \ifdim\beamer@sidebarwidth>0pt%
        \color{black}
        \vrule width\beamer@sidebarwidth height \beamer@headheight%
        \hskip-\beamer@sidebarwidth%
        \hbox to \beamer@sidebarwidth{\hss\vbox to
          \beamer@headheight{\vss\hbox{\color{fg}\insertlogo}\vss}\hss}%
      \else%
        \vrule width0pt height \beamer@headheight%  
      \fi%
    \end{beamercolorbox}
  }
\makeatother

\author{The Author}
\begin{document}

\frame{CTAN lion drawing by Duane Bibby.}

\end{document}

在此处输入图片描述

相关内容