LaTeX Beamer 笔记 —— 用LaTeX做演示文稿

LaTeX快速入门:Learn LaTeX in 30 minutes

我的博客:LaTeX Beamer 笔记

简介

Beamer是一个功能强大且灵活的LaTeX类,可用于创建美观的演示文稿。

\documentclass{beamer}
%Information to be included in the title page:
\title{Sample title}
\author{Anonymous}
\institute{Overleaf}
\date{2021}

\begin{document}

\frame{\titlepage}

\begin{frame}
\frametitle{Sample frame title}
This is some text in the first frame. This is some text in the first frame. This is some text in the first frame.
\end{frame}

\end{document}

用TeXStudio编译预览,可生成文档如下:

编译后,将生成一个两页的PDF文件。第一页是标题页,第二页包含示例内容。

  • \documentclass{Beamer} - 声明Beamer演示文稿
  • \document - 文档
  • \frame - 文档中的页
  • 变量以\为开头
  • 注释以%为开头
  • 单行内容 - \frame{xxx}
  • 多行内容 - \begin{frame} xxx \end{frame}
  • 可以通过\usetheme{xxx}指定使用的主题
  • \begin{document} 前的区域叫做导言区

Beamer主要功能

标题页

标题页的选项比简介中提供的选项多。下面是一个完整示例,大多数命令都是可选的:

\title[About Beamer] %optional
{About the Beamer class in presentation making}

\subtitle{A short story}

\author[Arthur, Doe] % (optional, for multiple authors)
{A.~B.~Arthur\inst{1} \and J.~Doe\inst{2}}

\institute[VFU] % (optional)
{
  \inst{1}%
  Faculty of Physics\\
  Very Famous University
  \and
  \inst{2}%
  Faculty of Chemistry\\
  Very Famous University
}

\date[VLC 2021] % (optional)
{Very Large Conference, April 2021}

\logo{\includegraphics[height=1cm]{overleaf-logo}}

  • \title[About Beamer] {About the Beamer class...}
    主标题,{}中的内容为标题,[]是可选的,其中的内容为标题缩写

缩写中的内容出现在演示文稿最底部(不同主题位置可能不同)

  • \subtitle

    副标题(可以没有)

  • \author[Arthur, Doe]{A.~B.~Arthur\inst{1} \and J.~Doe\inst{2}}

    作者。多个作者用\and分隔,\inst{1} - 上标

  • \institute[VFU]{\inst{1}Faculty...

    作者所属的机构,多个机构用\and分隔

  • \date[VLC 2021]{Very Large Conference, April 2021}

    日期/活动名称,显示在标题页的底部

  • \logo{\includegraphics...}

    logo。可以使用文本,也可以包含图像。在此主题中,logo设置在右下角(不同主题不一样)

目录页

创建目录页

\begin{frame}
\frametitle{Table of Contents}
\tableofcontents
\end{frame}

使用/section{xxx}来分章节,其中xxx为章节标题

突出当前章节标题

也可以在文档前添加如下代码,用于生成目录,并突出当前章节标题。

\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection]
  \end{frame}
}

突出当前副章节标题

也可以为 副章节 \subsection{xxx} 添加目录

\AtBeginSubsection[]{
	\begin{frame}
		\frametitle{Table of Contents}
		\tableofcontents[currentsubsection]
	\end{frame}
}

添加特效

itemize

逐项列出:

\begin{frame}
\frametitle{Sample frame title}
This is a text in second frame. 
For the sake of showing an example.

\begin{itemize}
 \item<1-> Text visible on slide 1
 \item<2-> Text visible on slide 2
 \item<3> Text visible on slide 3
 \item<4-> Text visible on slide 4
\end{itemize}
\end{frame}

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-arv6xJGo-1633669562937)(http://image.taqini.space/img/20211008082516.png)]

上述代码中有一个列表,由\begin{itemize}\end{itemize}声明,每个项前面都有一个数字编号,用<>括起来。编号表示元素将出现在哪张幻灯片中,如果在编号的末尾添加-,则该项在后续幻灯片继续显示,否则它将仅出现在该幻灯片中。

pause

\pause命令也可以实现特效:

\begin{frame}
 In this slide \pause

 the text will be partially visible \pause

 And finally everything will be there
\end{frame}

注:加入特效后,一个frame可以生成多页pdf

高亮

在演示文稿中,突出重点是一种很好的做法,可以让听众更容易地确定主题。

\begin{frame}
\frametitle{Sample frame title}

In this slide, some important text will be
\alert{highlighted} because it's important.
Please, don't abuse it.

\begin{block}{Remark}
Sample text
\end{block}

\begin{alertblock}{Important theorem}
Sample text in red box
\end{alertblock}

\begin{examples}
Sample text in green box. The title of the block is ``Examples".
\end{examples}
\end{frame}

  • \alert{highlighted} - 高亮文本
  • 三种高亮块:
    • \begin{block}{Remark} \end{block}
    • \begin{alertblock}{Important theorem} \end{alertblock}
    • \begin{examples} \end{examples}

自定义演示文稿

主题/颜色主题

在文档前加入\usetheme即可:

\usetheme{Madrid}

一个主题可以与一个颜色主题相结合,以改变不同元素使用的颜色。

\documentclass{beamer}
\usetheme{Madrid}
\usecolortheme{beaver}

Madrid主题的默认的蓝色变成了红色

TeXStudio中有多种主题可选(Wizard - Quick Beamer Presentation)

字体

字体大小

字体大小可以通过beamer类进行设置: \documentclass[17pt]{beamer}.

可用的字体大小有8pt、9pt、10pt、11pt、12pt、14pt、17pt、20pt。默认字体大小为11pt(对应于全屏模式下的22pt)。

字体类型

改变beamer演示文稿中的字体类型有两种方法,一种是使用字体主题,另一种是直接从系统导入字体。

字体主题
\documentclass{beamer}
\usefonttheme{structuresmallcapsserif}
\usetheme{Madrid}

\usefonttheme{}是自描述性的。可用的主题有:structurebold、structurebolditalic、StructureSallCapsSerif、StructureTalicsSerif、serif和default。

从系统导入字体

除此以外,还可以导入系统中安装的字体:

\documentclass{beamer}
\usepackage{bookman}
\usetheme{Madrid}

通过\usepackage{bookman}导入要在演示文稿中使用的bookman系列字体。可用字体取决于你安装的LATEX,常见字体有:mathptmx、helvet、avat、bookman、chancery、charter、culer、mathtime、mathptm、newcent、palatino和pifont。

分栏

有时,演示文稿中的信息以两列格式显示会更好:

\begin{frame}
\frametitle{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 thoughts, this is a nice looking
layout in some cases.
\end{columns}
\end{frame}
  • \begin{columns} xxx \end{columns} - 使用分栏
  • \column{0.5\textwidth} - 声明每列的宽度

显示中文

LaTeXstudio默认的编译器不支持中文,改为XeLaTeX即可:

若LaTeXstudio的pdf预览不显示中文,在导言区加入以下代码即可:

\usepackage{ctex}

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-cqCUDPDe-1633669562950)(http://image.taqini.space/img/20211008124441.png)]

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

TaQini852

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值