🔄Update: 引入模板框架
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
# beamer-setup 配置说明
|
||||
|
||||
## Beamer 样式配置
|
||||
|
||||
设置主题,包括导航栏样式,数学字体,主题颜色
|
||||
```latex
|
||||
\usetheme{default}
|
||||
\useoutertheme[subsection=false]{miniframes}
|
||||
\usefonttheme[onlymath]{serif}
|
||||
\definecolor{simplebeamercolor}{RGB}{57,89,199}
|
||||
\usecolortheme[named=simplebeamercolor]{structure}
|
||||
```
|
||||
|
||||
设置标题页样式:圆角,加阴影
|
||||
```latex
|
||||
\setbeamertemplate{title page}[default][colsep=-4bp,rounded=true,shadow=true]
|
||||
```
|
||||
|
||||
设置目录样式:section和subsection均开启编号,subsection加上缩进
|
||||
```latex
|
||||
\setbeamertemplate{section in toc}[sections numbered]
|
||||
\setbeamertemplate{subsection in toc}[subsections numbered]
|
||||
\addtobeamertemplate{subsection in toc}{\hspace{2em}}{}
|
||||
```
|
||||
|
||||
设置无序列表和有序列表的样式
|
||||
```latex
|
||||
\setbeamertemplate{itemize items}[circle]
|
||||
\setbeamertemplate{enumerate items}[default]
|
||||
```
|
||||
|
||||
设置caption样式:开启编号
|
||||
```latex
|
||||
\setbeamertemplate{caption}[numbered]
|
||||
```
|
||||
|
||||
设置底部样式:仅显示页码,移除导航按钮
|
||||
```latex
|
||||
\setbeamertemplate{footline}[frame number]{}
|
||||
\setbeamertemplate{navigation symbols}{}
|
||||
```
|
||||
|
||||
设置帧标题样式:在帧标题下面添加一条横线
|
||||
```latex
|
||||
\setbeamertemplate{frametitle}{\vspace*{0.5em}\insertframetitle\par\vskip-6pt\hrulefill\vspace{-0.1em}}
|
||||
```
|
||||
|
||||
设置标题样式
|
||||
```latex
|
||||
\setbeamercolor{title}{use=structure,fg=white,bg=structure.fg}
|
||||
```
|
||||
|
||||
设置顶部导航栏中的section样式
|
||||
```latex
|
||||
\setbeamercolor{section in head/foot}{fg=white,bg=structure.fg}
|
||||
```
|
||||
|
||||
设置各个元素的颜色样式
|
||||
```latex
|
||||
\setbeamercolor{block body}{bg=structure!10}
|
||||
\setbeamercolor{block title}{bg=structure!20}
|
||||
\setbeamercolor{block body alerted}{bg=alerted text.fg!10}
|
||||
\setbeamercolor{block title alerted}{bg=alerted text.fg!20}
|
||||
\setbeamercolor{block body example}{bg=green!10}
|
||||
\setbeamercolor{block title example}{bg=green!20}
|
||||
```
|
||||
|
||||
## 其它配置
|
||||
|
||||
导入常用的基础宏包
|
||||
```latex
|
||||
% fonts
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{mathrsfs}
|
||||
\usepackage{calligra}
|
||||
\usepackage{bm}
|
||||
|
||||
% math
|
||||
\usepackage{amsmath,amsthm,amsfonts,amssymb}
|
||||
|
||||
\usepackage{extarrows}
|
||||
\usepackage{booktabs}
|
||||
\usepackage{multirow}
|
||||
\usepackage{multicol}
|
||||
```
|
||||
|
||||
导入盒子宏包,并为`\tcbhighmath`命令设置预设样式
|
||||
```latex
|
||||
\usepackage[most]{tcolorbox}
|
||||
\tcbset{
|
||||
highlight math style={enhanced, colframe=blue!40,colback=yellow!20,arc=4pt,boxrule=1pt}
|
||||
}
|
||||
```
|
||||
|
||||
导入超链接支持的宏包
|
||||
```latex
|
||||
\usepackage{hyperref}
|
||||
\hypersetup{
|
||||
colorlinks=true,linkcolor=,urlcolor=cyan
|
||||
}
|
||||
```
|
||||
|
||||
插入图片以及子图的相关宏包,对图片文件夹路径进行配置
|
||||
```latex
|
||||
\usepackage{graphicx}
|
||||
\graphicspath{
|
||||
{./figure/}{./figures/}{./image/}{./images/}{./graphic/}{./graphics/}{./picture/}{./pictures/}
|
||||
}
|
||||
\usepackage{subcaption}
|
||||
```
|
||||
|
||||
导入算法环境的宏包
|
||||
```latex
|
||||
\usepackage[ruled,linesnumbered,noline]{algorithm2e}
|
||||
```
|
||||
|
||||
导入代码环境的宏包并配置样式
|
||||
```latex
|
||||
\usepackage{listings}
|
||||
\lstdefinestyle{simpleStyle}{
|
||||
basicstyle=\ttfamily\small,
|
||||
breaklines=true,
|
||||
keywordstyle=\color{blue},
|
||||
identifierstyle=\color{black},
|
||||
stringstyle=\color{violet},
|
||||
commentstyle=\color[RGB]{34,139,34},
|
||||
showstringspaces=false,
|
||||
frame=single,
|
||||
framesep=1em,
|
||||
}
|
||||
\lstset{style=simpleStyle}
|
||||
@@ -0,0 +1,275 @@
|
||||
# note-setup 配置说明
|
||||
|
||||
## 基本配置
|
||||
|
||||
导入常用的基础宏包
|
||||
```latex
|
||||
\usepackage{amsmath,amsthm,amsfonts,amssymb}
|
||||
\usepackage{mathtools}
|
||||
\usepackage{mathrsfs}
|
||||
\usepackage{bm}
|
||||
\usepackage{extarrows}
|
||||
\usepackage[a4paper, margin=1in]{geometry}
|
||||
\usepackage{float}
|
||||
\usepackage{indentfirst}
|
||||
\usepackage{anyfontsize}
|
||||
\usepackage{booktabs,multirow,multicol}
|
||||
\usepackage[shortlabels,inline]{enumitem}
|
||||
\usepackage{appendix}
|
||||
```
|
||||
|
||||
导入颜色支持的宏包
|
||||
```latex
|
||||
\usepackage[dvipsnames]{xcolor}
|
||||
```
|
||||
|
||||
插入图片以及子图的相关宏包,对图片文件夹路径进行配置
|
||||
```latex
|
||||
\usepackage{graphicx}
|
||||
\graphicspath{
|
||||
{./figure/}{./figures/}{./image/}{./images/}{./graphic/}
|
||||
{./graphics/}{./picture/}{./pictures/}
|
||||
}
|
||||
\usepackage{subcaption}
|
||||
```
|
||||
|
||||
导入算法环境的宏包
|
||||
```latex
|
||||
\usepackage[ruled,linesnumbered,noline]{algorithm2e}
|
||||
```
|
||||
|
||||
导入代码环境的宏包并配置样式
|
||||
```latex
|
||||
\usepackage{listings}
|
||||
\lstdefinestyle{simpleStyle}{
|
||||
basicstyle=\ttfamily\small,
|
||||
breaklines=true,
|
||||
keywordstyle=\color{blue},
|
||||
identifierstyle=\color{black},
|
||||
stringstyle=\color{violet},
|
||||
commentstyle=\color[RGB]{34,139,34},
|
||||
showstringspaces=false,
|
||||
numbers=left,
|
||||
numbersep=2em,
|
||||
numberstyle=\footnotesize,
|
||||
frame=single,
|
||||
framesep=1em,
|
||||
}
|
||||
\lstset{style=simpleStyle}
|
||||
```
|
||||
|
||||
导入超链接支持的宏包
|
||||
```latex
|
||||
\usepackage{hyperref}
|
||||
\hypersetup{
|
||||
colorlinks=true,linkcolor=,urlcolor=cyan
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 定理环境
|
||||
|
||||
修改 proof 环境的引导词为 Proof,样式为加粗无斜体
|
||||
```latex
|
||||
\renewcommand*{\proofname}{\normalfont\bfseries Proof}
|
||||
```
|
||||
|
||||
导入 thmtools 宏包,使用 `\declaretheorem` 命令来定义各种定理环境(比`\newtheorem`命令更加方便)
|
||||
```latex
|
||||
\usepackage{thmtools}
|
||||
```
|
||||
|
||||
使用的 `\declaretheorem` 命令参数包括:
|
||||
|
||||
- `style`: 定理环境样式,amsthm 内置的样式包括
|
||||
- plain(默认):引导词是正体,内容是斜体
|
||||
- definition:引导词和内容都是正体
|
||||
- remark:引导词是斜体,内容是正体
|
||||
- `name`:显示在正文中的引导词(不等于环境的名称)
|
||||
- `numbered`:是否开启编号
|
||||
- `numberwithin`、`sibling`:定义编号规则,例如
|
||||
- `numberwithin=section`:基于 section 编号
|
||||
- `sibling=theorem`:共享 `theorem` 环境的编号
|
||||
|
||||
|
||||
具体包括:
|
||||
|
||||
- 采用 plain 样式,定义 `theorem`/`theorem*`、`proposition`/`proposition*`、`corollary`/`corollary*`、`lemma`/`lemma*`、`claim`/`claim*` 环境
|
||||
```latex
|
||||
%% define environments
|
||||
|
||||
\declaretheorem[style=plain, name=Theorem, numbered=yes, numberwithin=section]{theorem}
|
||||
\declaretheorem[style=plain, name=Theorem, numbered=no]{theorem*}
|
||||
|
||||
\declaretheorem[style=plain, name=Proposition, numbered=yes, sibling=theorem]{proposition}
|
||||
\declaretheorem[style=plain, name=Proposition, numbered=no]{proposition*}
|
||||
|
||||
\declaretheorem[style=plain, name=Corollary, numbered=yes, sibling=theorem]{corollary}
|
||||
\declaretheorem[style=plain, name=Corollary, numbered=no]{corollary*}
|
||||
|
||||
\declaretheorem[style=plain, name=Lemma, numbered=yes, sibling=theorem]{lemma}
|
||||
\declaretheorem[style=plain, name=Lemma, numbered=no]{lemma*}
|
||||
|
||||
\declaretheorem[style=plain, name=Claim, numbered=yes, sibling=theorem]{claim}
|
||||
\declaretheorem[style=plain, name=Claim, numbered=no]{claim*}
|
||||
```
|
||||
- 采用 definition 样式,定义 `definition`/`definition*`、`example`/`example*`、`problem`/`problem*` 环境
|
||||
```latex
|
||||
\declaretheorem[style=definition, name=Definition, numbered=yes, numberwithin=section]{definition}
|
||||
\declaretheorem[style=definition, name=Definition, numbered=no]{definition*}
|
||||
|
||||
\declaretheorem[style=definition, name=Example, numbered=yes, numberwithin=section]{example}
|
||||
\declaretheorem[style=definition, name=Example, numbered=no]{example*}
|
||||
|
||||
\declaretheorem[style=definition, name=Problem, numbered=yes, numberwithin=section]{problem}
|
||||
\declaretheorem[style=definition, name=Problem, numbered=no]{problem*}
|
||||
```
|
||||
- 采用 remark 样式,定义 `remark`/`remark*` 环境
|
||||
```latex
|
||||
\declaretheorem[style=remark, name=Remark, numbered=yes, numberwithin=section]{remark}
|
||||
\declaretheorem[style=remark, name=Remark, numbered=no]{remark*}
|
||||
```
|
||||
- 使用 `\declaretheoremstyle` 命令定义新的 notestyle 样式,类似 remark 环境,但是引导词变成 Note,并且有颜色
|
||||
```latex
|
||||
\declaretheoremstyle[headfont=\color{orange!80}\bfseries, bodyfont=\normalfont, spaceabove=3pt, spacebelow=3pt]{notestyle}
|
||||
```
|
||||
- 采用新定义的 notestyle 样式,定义 `note`/`note*` 环境
|
||||
```latex
|
||||
\declaretheorem[style=notestyle, name=Note, numbered=yes, numberwithin=section]{note}
|
||||
\declaretheorem[style=notestyle, name=Note, numbered=no]{note*}
|
||||
```
|
||||
- 使用 `\declaretheoremstyle` 命令定义新的 solutionstyle 样式,类似 proof 环境,但是引导词变成 Solution
|
||||
```latex
|
||||
\declaretheoremstyle[headfont=\bfseries, bodyfont=\normalfont, spaceabove=3pt, spacebelow=3pt, qed=\ensuremath{\square}]{solutionstyle}
|
||||
```
|
||||
- 采用新定义的 solutionstyle 样式,定义 `solution`/`solition*` 环境
|
||||
```latex
|
||||
\declaretheorem[style=solutionstyle, name=Solution, numbered=yes, numberwithin=section]{solution}
|
||||
\declaretheorem[style=solutionstyle, name=Solution, numbered=no]{solution*}
|
||||
```
|
||||
|
||||
|
||||
## 定理环境的美化
|
||||
|
||||
导入 tcolorbox 宏包以使用盒子美化现有的定理环境
|
||||
```latex
|
||||
\usepackage[most]{tcolorbox}
|
||||
```
|
||||
|
||||
tcolorbox 宏包的功能非常复杂,这里只需要使用 `\tcolorboxenvironment` 命令。
|
||||
|
||||
首先封装一个 `\newtcbenvironment` 命令
|
||||
```latex
|
||||
\newcommand{\newtcbenvironment}[2]{
|
||||
\tcolorboxenvironment{#1}{#2, enhanced, breakable, sharp corners, boxrule=1pt}
|
||||
\tcolorboxenvironment{#1*}{#2, enhanced, breakable, rounded corners, boxrule=1pt}
|
||||
}
|
||||
```
|
||||
|
||||
它可以同时为 `#1` 以及 `#1*` 这两个环境加上盒子,公共参数:
|
||||
|
||||
- `#2`:在定义时传入的参数,这里主要是边框颜色和背景色
|
||||
- `enhanced`:样式增强
|
||||
- `breakable`:允许跨页
|
||||
- `boxrule=1pt`:边框宽度为 1pt
|
||||
|
||||
还有不同的参数:
|
||||
|
||||
- `#1` 盒子使用直角边框(`sharp corners`)
|
||||
- `#1*` 盒子使用圆角边框(`rounded corners`)
|
||||
|
||||
> 对 `\newtcbenvironment` 内部的公共参数部分进行调整,就可以实现所有盒子只保留左侧边框或者四周无边框等不同的效果。
|
||||
|
||||
下面就是为前面的各种定理环境加上盒子,参数是盒子的边框颜色 `colframe` 和背景色 `colback`
|
||||
```latex
|
||||
%% define styles
|
||||
|
||||
\newtcbenvironment{theorem}{colframe=RoyalPurple, colback=RoyalPurple!8}
|
||||
\newtcbenvironment{proposition}{colframe=RoyalPurple, colback=RoyalPurple!8}
|
||||
\newtcbenvironment{corollary}{colframe=NavyBlue, colback=SkyBlue!8}
|
||||
\newtcbenvironment{lemma}{colframe=NavyBlue, colback=SkyBlue!8}
|
||||
\newtcbenvironment{claim}{colframe=NavyBlue, colback=SkyBlue!8}
|
||||
|
||||
\newtcbenvironment{definition}{colframe=ForestGreen, colback=ForestGreen!5}
|
||||
\newtcbenvironment{example}{colframe=RawSienna, colback=RawSienna!5}
|
||||
\newtcbenvironment{problem}{colframe=WildStrawberry!30, colback=WildStrawberry!5}
|
||||
```
|
||||
|
||||
具体颜色如下表
|
||||
|
||||
| 环境名 | 盒子边框颜色 | 盒子背景色 |
|
||||
| :---------------------------: | :---------------: | :--------------: |
|
||||
| `theorem`, `proposition` | RoyalPurple | RoyalPurple!8 |
|
||||
| `corollary`, `lemma`, `claim` | NavyBlue | SkyBlue!8 |
|
||||
| `definition` | ForestGreen | ForestGreen!5 |
|
||||
| `example` | RawSienna | RawSienna!5 |
|
||||
| `problem` | WildStrawberry!30 | WildStrawberry!5 |
|
||||
|
||||
说明:
|
||||
|
||||
- 这里采用 `xcolor` 宏包所提供的标准颜色,`xxx!n`代表将颜色 `xxx` 以 `n%` 比例和白色混合得到的浅颜色。
|
||||
- 为了避免颜色过多,对语义类似的环境合并采用相同的盒子颜色。
|
||||
|
||||
此外,还添加了一个没有标题的简单盒子 `cbox`
|
||||
```latex
|
||||
%% cbox
|
||||
\newtcolorbox{cbox}[1][]{%
|
||||
enhanced,
|
||||
breakable,
|
||||
sharp corners,
|
||||
leftrule=2pt, rightrule=0pt, toprule=0pt, bottomrule=0pt,
|
||||
colframe=SkyBlue,
|
||||
colback=SkyBlue!8,
|
||||
#1
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 自定义封面页
|
||||
|
||||
自定义封面页(参考 [ElegantBook](https://github.com/ElegantLaTeX/ElegantBook) 以及它的若干衍生模板)
|
||||
```latex
|
||||
%% cover
|
||||
\usepackage{titling}
|
||||
\newcommand{\extrainfo}{}
|
||||
\renewcommand{\extrainfo}[1]{\renewcommand{\extrainfocontent}{#1}}
|
||||
\newcommand{\extrainfocontent}{}
|
||||
\newcommand{\makecover}[1]{%
|
||||
\begin{titlepage}
|
||||
\newgeometry{margin=0in}
|
||||
\parindent=0pt
|
||||
\includegraphics[width=\linewidth]{#1} % size = 1280*1024
|
||||
\vfill
|
||||
\begin{center}
|
||||
\parbox{0.618\textwidth}{%
|
||||
\raggedleft{\bfseries \Huge \thetitle} \\[0.6pt]
|
||||
\rule{0.618\textwidth}{4pt} \\
|
||||
}
|
||||
\end{center}
|
||||
\vfill
|
||||
\begin{center}
|
||||
\parbox{0.618\textwidth}{%
|
||||
\raggedleft\Large
|
||||
\begin{tabular}{r}
|
||||
\theauthor \\
|
||||
\thedate \\
|
||||
\end{tabular}%
|
||||
}
|
||||
\end{center}
|
||||
\vfill
|
||||
\begin{center}
|
||||
\parbox[t]{0.7\textwidth}{\centering \itshape \extrainfocontent}
|
||||
\end{center}
|
||||
\vfill
|
||||
\end{titlepage}
|
||||
\restoregeometry
|
||||
\thispagestyle{empty}
|
||||
}
|
||||
% USAGE
|
||||
% \extrainfo{xxx}
|
||||
% \makecover{/path/to/cover.png}
|
||||
```
|
||||
|
||||
这里没有选择覆盖`\maketitle`,而是改成新命令`\makecover`,接收的一个必要参数为封面图的路径。
|
||||
|
||||
封面图建议尺寸为1280*1024,尤其对于jpg格式的图片,尺寸不同会导致编译报错。
|
||||
Reference in New Issue
Block a user