LaTeX中常用代码段snippets(持续更新)
1.displaymath 单行数学环境,不带编号。
\begin{displaymath}
This\ is\ displaymath\ envirment.\ I\ don
't\ have\ a\ tag
\end{displaymath}
2.equation 单行数学环境,全文按序编号。
\begin{equation}
This\ is\ equation\ envirment.\ I\ have\ a\ tag
\end{equation}
3.itemize 条目环境,按小圆点排列。
\begin{itemize}
\item This is
\item itemize environment
\end{itemize}
4.enmerate 枚举环境,按数字序号排列。
\begin{enumerate}
\item This is
\item enumerate enviroment
\end{enumerate}
5.quotation 引用环境,将输入看作纯文本,有大缩进。
\begin{quotation}
This is quotation environment. I have big indent, and output plaintext.
\end{quotation}
6.verbatim 复读环境,字体特殊,将输入看作纯文本。
\begin{verbatim}
This is verbatim enviroment.I also output plaintext.
\end{verbatim}
7.tabular 表格环境。
\begin{tabular}{l|c|c}
Aloha&This is tabular environment & I can have many rows\\
\hline
I am BJ&Hello World &I love you\\
&I can make multiple lines & I can even enter $\int$
\end{tabular}
其中{}框住的三个字母lcc表示表格有三列,l:本列左对齐,c:本列居中,r:本列右对齐。&符号分割表项,\\换行,\hline添加水平线。
8.description 描述环境,将输入看作纯文本。
\begin{description}
\item[This is describe environment.]
\item[It seems cool.]
\end{description}
9.matrix 矩阵环境,使用时要加载amsmath包,并用美元括住。编译器会将matrix看作数学符号处理。
$$
\begin{matrix}
I& am& a\\
Matrix& I& am\\
seen& as& a\ symbol
\end{matrix}
$$
10.table 浮动表格环境,浮动体位置更灵活。
\begin{table}[hbt]
\begin{tabular}{l|cc}
& I& just\\
\hline
& like & tabular\\
& environment&but more complete
\end{tabular}
\caption{This is a floating table.}
\end{table}
11.preamble 引言环境。
\title{This is a preamble}
\author{Chester}
\date{\today}
\maketitle
12.figure 图片环境。
\begin{figure}[hbt]
\centering
\includegraphics{lenna.png}
\caption{lenna}
\end{figure
13.一个更灵活的图片环境,并且可以居中与缩放图片,需要graphicx包
{\centering\includegraphics[scale=0.85]{test.png} }\\ 注意这里必须要空一行,这和tex的对齐方式有关,留待日后
14.一个表格的实例,比较细节,含有合并单元格的操作,需要algorithm和algorithmic包
\begin{tabular}{|l|c|c|c}
\multicolumn{2}{}&&\multicolumn{2}{|c}{Predicted Classes}\\ \cline{3-4}
\multicolumn{2}{}&&\multicolumn{1}{|c|}{zero }& nonzero\\
\hline
Real&zero&975&5\\ \cline{2-4}
Class&nonzero&53&927\\ \hline
\end{tabular}\\
15.一个伪代码的实例(Naive Bayes)
\begin{algorithm}
\caption{Training Naive Bayes Classifier}
\label{alg:train_bayes}
\textbf{Input:} The training set with the labels $\mathcal{D}=\{(\mathbf{x}_i,y_i)\}.$
\begin{algorithmic}[1]
\STATE $\mathcal{V}\leftarrow$ the set of distinct words and other tokens found in $\mathcal{D}$\\
\FOR{each target value $c$ in the labels set $\mathcal{C}$}
\STATE $\mathcal{D}_c\leftarrow$ the training samples whose labels are $c$\\
\STATE $P(c)\leftarrow\frac{|\mathcal{D}_c|}{|\mathcal{D}|}$\\
\STATE $T_c\leftarrow$ a single document by concatenating all training samples in $\mathcal{D}_c$\\
\STATE $n_c\leftarrow |T_c|$
\FOR{each word $w_k$ in the vocabulary $\mathcal{V}$}
\STATE $n_{c,k}\leftarrow$ the number of times the word $w_k$ occurs in $T_c$\\
\STATE $P(w_k|c)=\frac{n_{c,k}+1}{n_c+|\mathcal{V}|}$
\ENDFOR
\ENDFOR
\end{algorithmic}
\end{algorithm}
LaTeX中常用代码段snippets(持续更新)的更多相关文章
- Android开发中常用的库总结(持续更新)
这篇文章用来收集Android开发中常用的库,都是实际使用过的.持续更新... 1.消息提示的小红点 微信,微博消息提示的小红点. 开源库地址:https://github.com/stefanjau ...
- Android中常用开发工具类—持续更新...
一.自定义ActionBar public class ActionBarTool { public static void setActionBarLayout(Activity act,Conte ...
- swiper 轮播中常用的效果,持续更新
swiper一款非常好用的轮播插件,支持移动端和PC端,用过很多次了,这次简单的总结一下.方便以后查找使用,说明一下,下面的例子是基于swiper 4.0+版本的,如果你是其他的版本,请自行前往官网查 ...
- js实用代码段(持续更新)
1.得到一个数,在一个有序数组中应该排在的位置序号: function orderInArr(num,arr) { if(num > arr[0]){ return 1 + arguments. ...
- PyTorch常用代码段整理合集
PyTorch常用代码段整理合集 转自:知乎 作者:张皓 众所周知,程序猿在写代码时通常会在网上搜索大量资料,其中大部分是代码段.然而,这项工作常常令人心累身疲,耗费大量时间.所以,今天小编转载了知乎 ...
- iOS:开发常用GitHub开源项目(持续更新)
IOS开发常用GitHub开源项目(持续更新) 数据类 开源库 作者 简介 AFNetworking Mattt 网络请求库 ASIHTTPRequest pokeb 网络请求库 Alamofire ...
- 用Handler的post()方法来传递线程中的代码段到主线程中执行
自定义的线程中是不能更新UI的,但是如果遇到更新UI的事情,我们可以用handler的post()方法来将更新UI的方法体,直接传送到主线程中,这样就能直接更新UI了.Handler的post()方法 ...
- C++入职学习篇--代码规范(持续更新)
C++入职学习篇--代码规范(持续更新) 一.头文件规范 在头文件中大家一般会定义宏.引入库函数.声明.定义全局变量等,在设计时最后进行分类,代码示范(自己瞎琢磨的,请多多指点): #ifndef T ...
- LaTeX中Python代码的语法高亮
LaTeX中Python代码的语法高亮 本文中,"{}"中的字母为LaTeX或Python的包名,只有"Pygments"是Python的包,其他都是LaTeX ...
随机推荐
- C++软件开发面试题总结
面试题有难有易,不能因为容易,我们就轻视,更不能因为难,我们就放弃.我们面对高薪就业的态度永远不变,那就是坚持.坚持.再坚持.出现问题,找原因:遇到困难,想办法.我们一直坚信只有在坚持中才能看到希望, ...
- 容器技术之Docker常用命令说明
前面我们聊了docker的基本概念.架构.镜像.网络.数据卷,回顾请参考https://www.cnblogs.com/qiuhom-1874/category/1766327.html:今天这篇博客 ...
- spring boot 入口源码分析
public ConfigurableApplicationContext run(String... args) { StopWatch stopWatch = new StopWatch(); / ...
- Typora 使用 Markdown 嵌入 LaTeX 数学公式符号语法
博客园不支持渲染 LaTeX 数学公式,需要用到什么公式,请复制到您所用的支持 LaTeX 的编辑器中查看实现效果.Typora 可以渲染 LaTeX 数学公式. 目录 行内与独行 行内公式 独行公式 ...
- Rocket - devices - PLIC
https://mp.weixin.qq.com/s/FR3yeLLBqy0n-fflw-ATgg 简单介绍TLPLIC的实现. 1. GatewayPLICIO PLIC是Platform-Leve ...
- Java实现 LeetCode 319 灯泡开关
319. 灯泡开关 初始时有 n 个灯泡关闭. 第 1 轮,你打开所有的灯泡. 第 2 轮,每两个灯泡你关闭一次. 第 3 轮,每三个灯泡切换一次开关(如果关闭则开启,如果开启则关闭).第 i 轮,每 ...
- Java实现 蓝桥杯VIP 算法提高 种树
算法提高 种树 时间限制:1.0s 内存限制:256.0MB 种树 问题描述 A城市有一个巨大的圆形广场,为了绿化环境和净化空气,市政府决定沿圆形广场外圈种一圈树.园林部门 得到指令后,初步规划出n个 ...
- 自动把网页px单位转换成rem
自动把网页px单位转换成rem 首先在你的项目开发环境中安装2个插件 然后在vue.config.js文件引入并重新启动服务器 这样就配置成功了,一起看看效果
- cocos2dx获得字体的宽高
Android: 1.在CCImage中添加下面的方法: //头文件声明略. cocos2d::CCSize CCImage::getStringSize(const char *text, cons ...
- 大顶堆与小顶堆应用---寻找前k小数
vector<int> getLeastNumber(vector<int>& arr,int k){ vector<int> vec(k,); if(== ...