语言, Latex专题

用Latex/Beamer制作幻灯片

LaTeX基础参考这篇:LaTeX安装和基本结构

用Latex制作PPT,可以省去自己微调排版,只要把内容填写好,然后选择个主题即可,熟练使用后比较省心。文档类型选择为beamer。 beamer的官方文档链接:https://ctan.org/pkg/beamer

beamer的基本结构为:

\documentclass{beamer}
\usepackage{ctex}  %一个支持中文宏包,如果不用中文无法显示
\usepackage{graphicx} %这个包提供\includegraphics命令来插入图片

\usetheme{Boadilla}  %主题
\usecolortheme{default}  %主题的颜色

\title{这是PPT标题}  %标题
\author{作者名字\inst{1},作者名字\inst{2}}     %作者
\institute{\inst{1}第一个单位\and\inst{2}第二个单位}  %这里的\and有换行的效果
\date{\today}        %时间(默认也会显示)
\logo{\includegraphics[height=1.0cm]{1.jpg}}  %右下角的小log

\begin{document}         %正文开始
	\begin{frame}    %相当于ppt里的一页
		\titlepage   %标题页
	\end{frame}
	\begin{frame}
		\frametitle{目录} %当前页的标题  
		\tableofcontents  %制作目录,需要\section{}配合
	\end{frame}
	
	\section{第一节}    %用来做目录
	\begin{frame}   
		\frametitle{当前页的标题1}  
		这是第一节第一页的内容。This is a text in the first frame. This is a text in the first frame. This is a text in the first frame.
	\end{frame}
	
	\section{第二节}  
	\begin{frame}  
		\frametitle{当前页的标题2} 
		这是第二节第一页的内容。这里使用了\textbackslash pause。\pause This is a text in the second frame. This is a text in the second frame. This is a text in the second frame.  %\pause是暂停,前后会分成两页。
	\end{frame}
	\begin{frame}
	    \frametitle{当前页的标题3:Two-column slide}
	    \begin{columns}   %分成列
	    	\column{0.5\textwidth}  %占用一半  
	    	This is a text in first column.
	    	$$E=mc^2$$
	    	\begin{itemize}  %制作列表
	    		\item First item
	    		\item Second item
	    	\end{itemize}
	    	\column{0.5\textwidth}  %占用一半  
	    	This text will be in the second column
	    	and on a second tought this is a nice looking
	    	layout in some cases.
	    \end{columns}
	\end{frame}
\end{document}

编译结果为:

关于主题,可以在下面这个链接中查找选择(主题矩阵,纵向是主题名称,横向是颜色主题名称):https://hartwork.org/beamer-theme-matrix/

有的主题底部没有显示页数,或者底部内容要自定义,可以在导言区加上这一片代码:

%在导言区加上这一片,在底部可以显示作者、标题、日期和页数。
\setbeamertemplate{footline}{%
	\leavevmode%
	\hbox{%
		\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
			\usebeamerfont{author in head/foot}\insertshortauthor
		\end{beamercolorbox}%
		\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
			\usebeamerfont{title in head/foot}\insertshorttitle
		\end{beamercolorbox}%
		\begin{beamercolorbox}[wd=.333333\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%
}

参考资料:

[1] https://www.overleaf.com/learn/latex/Beamer

[2] 从零开始用beamer做学术报告幻灯片

[3] Beamer 使用笔记

5,788 次浏览

【说明:本站主要是个人的一些笔记和代码分享,内容可能会不定期修改。为了使全网显示的始终是最新版本,这里的文章未经同意请勿转载。引用请注明出处:https://www.guanjihuan.com

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Captcha Code