将logo放在左上角
时间: 2023-08-05 12:08:56 浏览: 84
好的,下面是将logo放在左上角的代码:
```tex
\documentclass{beamer}
% 设置主题
\usetheme{Madrid}
% 设置颜色主题
\usecolortheme{beaver}
% 设置字体主题
\usefonttheme{serif}
% 设置导航栏
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.3\paperwidth,ht=2.5ex,dp=1.125ex,leftskip=.3cm,rightskip=.3cm]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.4\paperwidth,ht=2.5ex,dp=1.125ex,leftskip=.3cm,rightskip=.3cm]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.3\paperwidth,ht=2.5ex,dp=1.125ex,leftskip=.3cm,rightskip=.3cm]{date in head/foot}%
\usebeamerfont{date in head/foot}\insertshortdate
\end{beamercolorbox}%
}%
}
% 设置本页导航栏加重颜色处理
\setbeamertemplate{headline}{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{palette primary}%
\raggedright
\hspace*{2em}%
{\sffamily\footnotesize\color{white}\insertsectionhead\hfill\insertsubsectionhead\hfill\inserttitle\hspace*{2em}}%
\hspace*{2em}\vskip2pt%
\end{beamercolorbox}%
}%
}
% 设置楷体字体
\usepackage{fontspec}
\setmainfont{KaiTi}
% 导入logo
\usepackage{graphicx}
\logo{\includegraphics[height=1cm]{logo.png}\vspace{-8pt}}
\title{这里是标题}
\author{这里是作者}
\date{\today}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\section{第一节}
\subsection{小节1}
\begin{frame}
这里是第一节小节1的内容。
\end{frame}
\subsection{小节2}
\begin{frame}
这里是第一节小节2的内容。
\end{frame}
\section{第二节}
\subsection{小节1}
\begin{frame}
这里是第二节小节1的内容。
\end{frame}
\subsection{小节2}
\begin{frame}
这里是第二节小节2的内容。
\end{frame}
\end{document}
```
在这个代码中,我们使用了与之前相同的导航栏设置,并通过`graphicx`宏包导入了一个logo。不同的是,我们将`logo.png`放置在了`\logo`命令中,并且在logo下方加了一个`-8pt`的负间距,使其与导航栏对齐。这样,logo就会出现在左上角。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![ppt](https://img-home.csdnimg.cn/images/20210720083527.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)