Latex使用:在latex中添加算法模块
在Miktex下有三个latex algorithm包,分别为:algorithm,algorithmic,algorithm2e三个,其中algorithm,algorithmic经常成套使用:
latex中algorithm模板为:
latex文件中顶端加入的package:
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{setspace}
算法块代码:
\begin{algorithm}[htb]
\setstretch{1.35} %设置具有指定弹力的橡皮长度(原行宽的1.35倍)
\caption{}
\label{alg:Framwork}
\begin{algorithmic}
\REQUIRE ~~\\
The set of positive samples for current batch, $P_n$;\\
The set of unlabelled samples for current batch, $U_n$;\\
Ensemble of classifiers on former batches, $E_{n-}$;
\ENSURE ~~\\
Ensemble of classifiers on the current batch, $E_n$;
Extracting the set of reliable negative and/or positive samples $T_n$ from $U_n$ with help of $P_n$;\\
\label{ code:fram:extract }
Training ensemble of classifiers $E$ on $T_n \cup P_n$, with help of data in former batches;\\
\label{code:fram:trainbase}
$E_n=E_{n-}\cup E$;\\
\label{code:fram:add}
Classifying samples in $U_n-T_n$ by $E_n$;\\
\label{code:fram:classify}
Deleting some weak classifiers in $E_n$ so as to keep the capacity of $E_n$;\\
\label{code:fram:select}
$E_n$;\\
\end{algorithmic}
\end{algorithm}
实际算法结果图示为:

第二种用法:
使用algorithm2e包进行处理
\documentclass{article}
\usepackage{algorithm2e,setspace}
\begin{document}
\begin{algorithm}
\setstretch{1.35}
\SetAlgoLined
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}
\bigskip
\begin{algorithm}
\SetAlgoLined
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next section\;
current section becomes this one\;
}{
go back to the beginning of current section\;
}
}
\caption{How to write algorithms}
\end{algorithm}
\end{document}
上述代码分别对应两个算法,所获得的算法块分别为:

Latex中的常用算法块如上所述,使用过程中其它技巧可查询之后进行设置。
上述记录仅用来对latex使用过程中的心得体会进行总结。
个人感悟:写latex一定要静下心,要不然很容易出现低级错误。遇到不会的格式或方法,勤用搜索引擎去寻找答案。
其实在这里自己是被行距问题卡了很长时间,遇到的问题是因为算法的行距太小:
行距问题的设置网络搜索就可以解决,查阅刘海洋的《latex入门》也可以得到很好解决。
Latex使用:在latex中添加算法模块的更多相关文章
- CMake中添加Qt模块的合理方法
https://www.jianshu.com/p/7eeb6f79a275 转载自这里 用CMake来组织的工程中要用Qt首先要设置.找到Qt相关模块.主要是通过find_package这个CMak ...
- 一、SAP中添加一个模块到收藏夹后,显示事务代码
一.在SAP中,如果添加一个模块到收藏夹,默认是看不到事务代码的,如图: 二.我们在附件->设置中勾选显示技术名称 三.保存之后,就会显示出事务代码,如图所示: 不忘初心,如果您认为这篇文章有价 ...
- centos下python中添加easygui模块
前提:python中要集成Tkinter,Tkinter模块("Tk 接口")是Python的标准Tk GUI工具包的接口.Tk和Tkinter可以在大多数的Unix平台下使用,同 ...
- 【定制Android系统】Android O 在ROM中添加自己的 so 库(1)——Android.mk 与 Android.bp 的区别【转】
本文转载自: 版权声明:本文为博主原创文章,转载时请注明原作者及出处. https://blog.csdn.net/u014248312/article/details/82020204需求:在 ...
- opencv第二课,使用cmake编译OpenCV,并添加opencv_contrib模块
一.下载安装cmake 想要在Windows平台下生成OpenCV的解决方案,我们需要一个名为cmake的开源软件,可以在camke的官网:http://www.cmake.org/上下载到 或者点击 ...
- Java 在Word中添加数学公式(Latex/MathML)
本文介绍通过Java程序在Word文档中添加数学公式的方法.添加时,可添加latex数学公式或者MathML数学公式.详细内容见下文. 1. 程序环境 Word测试文档:.docx 2013 Word ...
- ZH奶酪:在博客中添加Latex公式
1. 点击编辑器中的插入图片: 2.在URL输入下边的地址: http://latex.codecogs.com/gif.latex?你的latex代码 就可以了-
- 在jekyll模板博客中添加网易云模块
最近使用GitHub Pages + Jekyll 搭建了个人博客,作为一名重度音乐患者,博客里面可以不配图,但是不能不配音乐啊. 遂在博客里面引入了网易云模块,这里要感谢网易云的分享机制,对开发者非 ...
- Eclipse中配置weka,以及添加算法
Eclipse中配置weka 1 找到weka的安装位置,寻找weka的压缩文件weka-src.jar,将压缩文件解压,解压出的文件夹weka-src. 2 打开Eclipse,新建Java pro ...
随机推荐
- unset MAILCHECK
文件/etc/profile尾部有: unset MAILCHECK 为了解决:每次登陆linux总是提示:you hava a new mail
- openresty火焰图安装
1.下载systemtap安装包并安装 从https://sourceware.org/systemtap/ftp/releases/下载最新版的systemtap.tar.gz压缩包 我安装的时候, ...
- python下载安装搭建
python官网下载python运行环境(https://www.python.org/downloads/),建议下载稳定版本,不推荐使用最新版本 安装 然后我们打开CMD,在里面输入python, ...
- IDEA导包(以junit为例)
## IDEA导包(以junit为例) 1. 准备junit的jar包: * hamcrest-core-1.3.jar * junit-4.12.jar 2. 在项目中新建文件夹:lib 3. 将j ...
- day67
昨日回顾 1 orm 创建表,新增字段,修改,删除字段,不能创建数据库 -字段属性phone=models.CharField(max_length=64,null=True) -null=Tru ...
- 理解ASP.NET的IDataReader
理解ASP.NET的IDataReader ADO.NET DataReader对象可以从数据库中检索只读.只进的数据流.因为每次在内存中的数据只有一行,所以使用DataReader可提高应用程序的性 ...
- 常用的php数组函数
以下是自己比较常用的数组函数 数组元素增加减少array_pusharray_poparray_shiftarray_unshift array_splice (对数组的增删改) array_sli ...
- Liunx-mkdir命令
1. 新建一个文件夹 one 2. 新建三个文件夹three,four,five 3. 新建一个多层级文件夹 201904/a/01
- 20155207 《网络对抗》 Exp9 Web安全基础
20155207 <网络对抗> Exp9 Web安全基础 实验内容 关于WebGoat Cross-Site Scripting(XSS)练习 Injection Flaws练习 CSRF ...
- 20155235 《网络攻防》 实验五 MSF基础应用
20155235 <网络攻防> 实验五 MSF基础应用 实验内容 一个主动攻击实践,如ms08_067; (1分) 一个针对浏览器的攻击,如ms11_050:(1分) 一个针对客户端的攻击 ...