本文最后更新于 2025年6月21日 晚上
此处用于存档xjtuthesis模板的Beamer常用功能合集。Overleaf上的xjtuthesis模板
逐帧展示
1 2 3 4 5 6
| \begin{frame}{用Beamer很高大上?} \begin{itemize}[<+-| alert@+>] \item 大家都会\LaTeX{},好多学校都有自己的Beamer主题 \item 中文支持请选择 Xe\LaTeX{} 编译选项 \end{itemize} \end{frame}
|
使用alert可以自动生成逐帧显示。
超链接与引用
1 2 3 4 5 6 7 8 9
| \begin{frame} \begin{itemize} \item 有一些 \LaTeX{} 自带的 \item 有一些Tsinghua的 \item 本模板来源自THU Beamer Theme \item 但是最初的 \href{http://far.tooold.cn/post/latex/beamertsinghua}{\color{purple}{link}} \cite{origin}已经失效了 \item 这是原作者在16-17年做的一些ppt:\href{https://github.com/Trinkle23897/oi_slides}{\color{blue}{戳我}} \end{itemize} \end{frame}
|
1 2 3 4 5 6 7 8 9 10
| \begin{frame}{这一份主题与原始的THU Beamer Theme区别在于} \begin{itemize} \item 顶栏的小点变成一行而不是多行 \item 中文采用楷书 \item 修改了主题色为南邮校徽颜色 \item 参考文献格式按照毕设标准进行了修改 \item 更多该模板的功能可以参考 \url{https://www.latexstudio.net/archives/4051.html} \item 下面列举出了一些Beamer的用法,部分节选自 \url{https://tuna.moe/event/2018/latex/} \end{itemize} \end{frame}
|
二分表格示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| \begin{frame}{Why Beamer} \begin{itemize} \item \LaTeX 广泛用于学术界,期刊会议论文模板 \end{itemize} \begin{table}[h] \centering \begin{tabular}{c|c} Microsoft\textsuperscript{\textregistered} Word & \LaTeX \\ \hline 文字处理工具 & 专业排版软件 \\ 容易上手,简单直观 & 容易上手 \\ 所见即所得 & 所见即所想,所想即所得 \\ 高级功能不易掌握 & 进阶难,但一般用不到 \\ 处理长文档需要丰富经验 & 和短文档处理基本无异 \\ 花费大量时间调格式 & 无需担心格式,专心作者内容 \\ 公式排版差强人意 & 尤其擅长公式排版 \\ 二进制格式,兼容性差 & 文本文件,易读、稳定 \\ 付费商业许可 & 自由免费使用 \\ \end{tabular} \end{table} \end{frame}
|
无编号公式
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| \begin{frame}{排版举例} \begin{exampleblock}{无编号公式} \begin{equation*} J(\theta) = \mathbb{E}_{\pi_\theta}[G_t] = \sum_{s\in\mathcal{S}} d^\pi (s)V^\pi(s)=\sum_{s\in\mathcal{S}} d^\pi(s)\sum_{a\in\mathcal{A}}\pi_\theta(a|s)Q^\pi(s,a) \end{equation*} \end{exampleblock} \begin{exampleblock}{多行多列公式\footnote{如果公式中有文字出现,请用 $\backslash$mathrm\{\} 或者 $\backslash$text\{\} 包含,不然就会变成 $clip$,在公式里看起来比 $\mathrm{clip}$ 丑非常多。}} \begin{align} Q_\mathrm{target}&=r+\gamma Q^\pi(s^\prime, \pi_\theta(s^\prime)+\epsilon)\\ \epsilon&\sim\mathrm{clip}(\mathcal{N}(0, \sigma), -c, c)\nonumber \end{align} \end{exampleblock} \end{frame}
|
编号多行公式
1 2 3 4 5 6 7 8 9 10 11 12 13
| \begin{frame} \begin{exampleblock}{编号多行公式} \begin{multline} A=\lim_{n\rightarrow\infty}\Delta x\left(a^{2}+\left(a^{2}+2a\Delta x+\left(\Delta x\right)^{2}\right)\right.\label{eq:reset}\\ +\left(a^{2}+2\cdot2a\Delta x+2^{2}\left(\Delta x\right)^{2}\right)\\ +\left(a^{2}+2\cdot3a\Delta x+3^{2}\left(\Delta x\right)^{2}\right)\\ +\ldots\\ \left.+\left(a^{2}+2\cdot(n-1)a\Delta x+(n-1)^{2}\left(\Delta x\right)^{2}\right)\right)\\ =\frac{1}{3}\left(b^{3}-a^{3}\right) \end{multline} \end{exampleblock} \end{frame}
|
分栏功能
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| \begin{frame}{应用:如何让人笑起来} \begin{figure}[htpb] \captionsetup{font={scriptsize}} \centering \includegraphics[width=0.5\linewidth]{pic/如何让人笑起来.png} \caption{Flow-based Model人脸变形示意图} \end{figure} \begin{minipage}{0.45\linewidth} \begin{footnotesize} 训练过程 \end{footnotesize} \scriptsize \begin{enumerate} \item 收集不笑脸数据集、笑脸数据集; \item 分别计算不笑脸数据集、笑脸数据集中图片的$z$值,再分别计算两个数据集的均值$z_1,z_2$,可得$z_{smile}=z_2 - z_1$ \end{enumerate} \end{minipage} \hfill \begin{minipage}{0.45\linewidth} \begin{footnotesize} 生成过程 \end{footnotesize} \scriptsize \begin{enumerate} \item 拿到待处理图片$x$,经过$G^{-1}$,得到$z=G^{-1}(x)$; \item 计算$z^\prime = z + z_{smile}$ \item 生成$x^\prime = G(z^\prime)$ \end{enumerate} \end{minipage} \end{frame}
|
横线样式表格
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| \begin{frame}[fragile]{\LaTeX{} 常用命令} \begin{exampleblock}{命令} \centering \footnotesize \begin{tabular}{llll} \cmd{chapter} & \cmd{section} & \cmd{subsection} & \cmd{paragraph} \\ 章 & 节 & 小节 & 带题头段落 \\\hline \cmd{centering} & \cmd{emph} & \cmd{verb} & \cmd{url} \\ 居中对齐 & 强调 & 原样输出 & 超链接 \\\hline \cmd{footnote} & \cmd{item} & \cmd{caption} & \cmd{includegraphics} \\ 脚注 & 列表条目 & 标题 & 插入图片 \\\hline \cmd{label} & \cmd{cite} & \cmd{ref} \\ 标号 & 引用参考文献 & 引用图表公式等\\\hline \end{tabular} \end{exampleblock} \begin{exampleblock}{环境} \centering \footnotesize \begin{tabular}{lll} \env{table} & \env{figure} & \env{equation}\\ 表格 & 图片 & 公式 \\\hline \env{itemize} & \env{enumerate} & \env{description}\\ 无编号列表 & 编号列表 & 描述 \\\hline \end{tabular} \end{exampleblock} \end{frame}
|
代码环境示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| \begin{frame}[fragile]{\LaTeX{} 环境命令举例} \begin{minipage}{0.5\linewidth} \begin{lstlisting}[language=TeX] \begin{itemize} \item A \item B \item C \begin{itemize} \item C-1 \end{itemize} \end{itemize} \end{lstlisting} \end{minipage}\hspace{1cm} \begin{minipage}{0.3\linewidth} \begin{itemize} \item A \item B \item C \begin{itemize} \item C-1 \end{itemize} \end{itemize} \end{minipage} \medskip \pause \begin{minipage}{0.5\linewidth} \begin{lstlisting}[language=TeX] \begin{enumerate} \item 巨佬 \item 大佬 \item 萌新 \begin{itemize} \item[n+e] 瑟瑟发抖 \end{itemize} \end{enumerate} \end{lstlisting} \end{minipage}\hspace{1cm} \begin{minipage}{0.3\linewidth} \begin{enumerate} \item 巨佬 \item 大佬 \item 萌新 \begin{itemize} \item[n+e] 瑟瑟发抖 \end{itemize} \end{enumerate} \end{minipage} \end{frame}
|
数学公式和代码环境示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| \begin{frame}[fragile]{\LaTeX{} 数学公式} \begin{columns} \begin{column}{.55\textwidth} \begin{lstlisting}[language=TeX] $V = \frac{4}{3}\pi r^3$
\[ V = \frac{4}{3}\pi r^3 \]
\begin{equation} \label{eq:vsphere} V = \frac{4}{3}\pi r^3 \end{equation} \end{lstlisting} \end{column} \begin{column}{.4\textwidth} $V = \frac{4}{3}\pi r^3$ \[ V = \frac{4}{3}\pi r^3 \] \begin{equation} \label{eq:vsphere} V = \frac{4}{3}\pi r^3 \end{equation} \end{column} \end{columns} \begin{itemize} \item 更多内容请看 \href{https://zh.wikipedia.org/wiki/Help:数学公式}{\color{purple}{这里}} \end{itemize} \end{frame}
|
表格示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| \begin{frame}[fragile] \begin{columns} \column{.6\textwidth} \begin{lstlisting}[language=TeX] \begin{table}[htbp] \caption{编号与含义} \label{tab:number} \centering \begin{tabular}{cl} \toprule 编号 & 含义 \\ \midrule 1 & 4.0 \\ 2 & 3.7 \\ \bottomrule \end{tabular} \end{table} 公式~(\ref{eq:vsphere}) 的 编号与含义请参见 表~\ref{tab:number}。 \end{lstlisting} \column{.4\textwidth} \begin{table}[htpb] \centering \caption{编号与含义} \label{tab:number} \begin{tabular}{cl}\toprule 编号 & 含义 \\\midrule 1 & 4.0\\ 2 & 3.7\\\bottomrule \end{tabular} \end{table} \normalsize 公式~(\ref{eq:vsphere})的编号与含义请参见表~\ref{tab:number}。 \end{columns} \end{frame}
|
矢量图示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| \begin{frame}{作图} \begin{itemize} \item 矢量图 eps, ps, pdf \begin{itemize} \item METAPOST, pstricks, pgf $\ldots$ \item Xfig, Dia, Visio, Inkscape $\ldots$ \item Matlab / Excel 等保存为 pdf \end{itemize} \item 标量图 png, jpg, tiff $\ldots$ \begin{itemize} \item 提高清晰度,避免发虚 \item 应尽量避免使用 \end{itemize} \end{itemize} \begin{figure}[htpb] \centering \includegraphics[width=0.2\linewidth]{pic/xjut_Logo.png} \caption{这个校徽就是矢量图,虽然看起来不像,但确实是矢量图格式} \end{figure} \end{frame}
|
参考文献示例
1 2 3 4 5 6
| \begin{frame}[allowframebreaks] \bibliography{ref} \bibliographystyle{xjut} \end{frame}
|
公式字号大小调整
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| \tiny \scriptsize \footnotesize \small \normalsize \large \Large \LARGE \huge \Huge
\begin{footnotesize} \begin{equation*} x^2 + y^2 = z^2 \end{equation*} \end{footnotesize}
\fontsize{5.5pt}{5pt}\selectfont \begin{equation*} x^2 + y^2 = z^2 \end{equation*}
|
数学证明QED
在 LaTeX 中,证毕符号(即右下角的方框)通常有以下几种实现方式,你可以根据自己的需求选择合适的方法:
- 使用
\qed
命令(最常用):自动放在证明环境的末尾。
1 2 3 4 5
| \begin{proof} 这里是你的证明内容... 最后一步得出结论。 \qed \end{proof}
|
- 说明:
- 如果使用
\usepackage{amsthm}
包,proof
环境会自动在末尾添加 \qed
,无需手动输入。
- 若想手动调整位置(如在行间公式后),可直接用
\qed
。
- 使用
\qedsymbol
命令:手动放置证毕符号(不依赖证明环境)。
- 说明:
\qedsymbol
会生成一个实心方框(□),可放在任意位置。
- 使用
\hfill\ensuremath{\square}
:自定义证毕符号(如使用空心方框)。
- 说明:
\hfill
将符号推到行末,$\square$
生成空心方框(◻)。
- 若需要实心方框,可使用
$\blacksquare$
。
符号的正上/下文本
overset
1
| X \stackrel{\text{def}}{=} Y \quad Z \stackrel{i.i.d.}{\sim} N(0,1)
|
长等号
1 2 3
| \usepackage{amsmath}
A \xlongequal{\text{def}} B
|
顶部底部注释
1
| \underbrace{a + b + c}_{n \text{ 项}} \quad \overbrace{x \cdot x \cdots x}^{n \text{ 次}}
|
创建子图
横向子图
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| \begin{figure}[htbp] \centering \begin{minipage}[t]{0.45\textwidth} \centering \includegraphics[width=\textwidth]{pic/coupling layer-stacking1.png} \end{minipage} \begin{minipage}[t]{0.45\textwidth} \centering \includegraphics[width=\textwidth]{pic/coupling layer-stacking2.png} \end{minipage} \caption{耦合层堆叠(stacking)示意图} \end{figure}
|
修改图片注释大小
问题描述:如果我使用’\caption{\tiny}',这只能改变caption中内容的字号大小,而无法改变“图11”字样的大小
全局修改
1 2
| \usepackage{caption} \captionsetup{font={tiny},labelsep=colon}
|
局部修改
1 2 3 4 5 6
| \begin{figure}[htpb] \captionsetup{font={tiny}} \centering \includegraphics[width=0.45\linewidth]{pic/Glow示意图.png} \caption{\tiny Glow中$1\times1$ Convolution示意图} \end{figure}
|
积分上下限的竖线
1 2 3 4 5
| | \big| \bigg| \Big| \Bigg|
|
罗马数字
1 2 3 4 5
| \uppercase\expandafter{\romannumeral2} 后面可以输入不同的数字,例如输入2,得到大写罗马数字2,
\romannumeral2 后面可以输入不同的数字,例如输入2,得到小写罗马数字2。
|
Beamer中插入空行