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 ...
随机推荐
- Keepalived 原理与实战
Keepalived 原理与实战 随着系统架构的逐渐演化,服务器的数量和结构会越来越复杂,例如 Web 服务器集群的搭建,提高了系统的性能,同时也提高了系统维护的复杂度,我们需要对集群中各台服务器进行 ...
- GO 使用Webhook 实现github 自动化部署
通常大家开发大部分是本地git push 提交,服务器上git pull 手动更新.git 可以使用webhook实现自动部署.webhook是仓库平台的一个钩子事件,通过hook 钩子监听代码,回调 ...
- UIAutomator2安装及连接
记录一下自己的偿试过程,内容来自:https://github.com/openatx/uiautomator2 d.service("uiautomator").stop()是因 ...
- 解决ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 这种问题需要强行重新修改密码,方法 ...
- CF1353E K-periodic Garland(贪心/dp)
Question 有n盏灯,0代表暗,1代表亮,相邻两个1之间为周期k,求出最少的改变次数 Solution First 贪心方法 详见博客https://blog.csdn.net/cheng__y ...
- Linux,Mac下MySQL的安装及一些知识点的整理
Linux下载安装 在服务器上下载的话,需要安装Mysql5.7相关的yum源 wget https://dev.mysql.com/get/mysql80-community-release-el7 ...
- 分布式项目开发-web.xml基础配置
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http:// ...
- 07 . Python3函数
Python3函数 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 函数能提高应用的模块性,和代码的重复利用率.Python提供了许多内建函数,比如print().我们可以直接调用 ...
- 【Tomcat】JSP使用Session、Cookie实现购物车
购物界面shop.jsp 初始页面 添加商品后,在session中设置属性,重定向回到shop.jsp,然后根据session的内容显示结果 Cookie设置setMaxAge可以延长session的 ...
- Java 第十一届 蓝桥杯 省模拟赛 字母重新排列
字母重新排列 题目 问题描述 将LANQIAO中的字母重新排列,可以得到不同的单词,如LANQIAO.AAILNOQ等,注意这7个字母都要被用上,单词不一定有具体的英文意义. 请问,总共能排列如多少个 ...