加载中…
个人资料
LaTeX_Fun
LaTeX_Fun
  • 博客等级:
  • 博客积分:0
  • 博客访问:33,286
  • 关注人气:2,408
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

LaTeX354:latex中algorithm2e包的用法示例

(2010-09-25 15:34:52)
标签:

latex

algorithm2e

示例

去掉

竖线

分类: 小技巧

QQ群:91940767/145316219/141877998/80300084/194770436
淘宝店:http://latexstudio.taobao.com
技巧续篇:http://latexstudio.net/
常见数学公式问题集下载

1.首先添加如下内容:
\usepackage[linesnumbered,boxed]{algorithm2e}
2.然后正文中添加如下示例:
\begin{algorithm}
\caption{identifyRowContext}
\KwIn{$r_i$ , $Backgrd(T_i)$=${T_1,T_2,\ldots,T_n}$ and similarity threshold $\theta_r$}
\KwOut{$con(r_i)$}
$con(r_i)= \Phi$\;
\For{$j=1;j \le n;j \ne i$}
{
 float $maxSim=0$\;
 $r^{maxSim}=null$\;
  \While{not end of $T_j$}
 {
     compute Jaro($r_i,r_m$)($r_m \in T_j$)\;
     \If{$(Jaro(r_i,r_m) \ge \theta _r) \wedge ((Jaro(r_i,r_m) \ge r^{maxSim}) $}
      {
           replace $r^maxSim$ with $r_m$\;
       
 }
$con(r_i)=con(r_i) \cup {r^{maxSim}}$\;
}
return $con(r_i)$\;
\end{algorithm}
3.效果运行可知。
LaTeX354:latex中algorithm2e包的用法示例
扩展:
一、如何修改算法的标题为中文“算法”?
\renewcommand{\algorithmcfname}{算法} 即可
二、如何去掉算法中的竖线?
\SetAlgoNoLine 放在算法中即可。
三、若是使用其他标题样式,可以使用:
\usepackage[ruled,vlined]{algorithm2e}
这些默认参数来定制标题,caption宏包并不能对其进行修改。其他样式
参看:http://mirror.bjtu.edu.cn/CTAN/macros/latex/contrib/algorithm2e/algorithm2e.pdf

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有