LaTex:算法排版



排版可能需要的包:

\usepackage{algorithm} //format of the algorithm

\usepackage{algorithmic} //format of the algorithm

\usepackage{multirow} //multirow for format of table

\usepackage{amsmath}

\usepackage{xcolor}

\DeclareMathOperator*{argmin}{argmin} //argmin或argmax公式的排版

\enewcommand{algorithmicrequire}{ extbf{Input:}} //Use Input in the format of Algorithm

\enewcommand{algorithmicensure}{ extbf{Output:}} //UseOutput in the format of Algorithm

排版图片可能需要的包:

\usepackage{graphics}

\usepackage{graphicx}

\usepackage{epsfig}

算法的排版举例:

\begin{algorithm}[htb] %算法的开始

\caption{ Framework of ensemble learning for our system.} %算法的标题

\label{alg:Framwork} %给算法一个标签,这样方便在文中对算法的引用

\begin{algorithmic}[1] %这个1 表示每一行都显示数字

\REQUIRE ~~\ %算法的输入参数:Input

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-1}$;

\ENSURE ~~\ %算法的输出:Output

\Ensemble of classifiers on the current batch, $E_n$;

\STATE Extracting the set of reliable negative and/or positive samples $T_n$ from $U_n$ with help of $P_n$; label{code:fram:extract} %算法的一个陈述,对应算法的一个步骤或公式之类的; label{ code:fram:extract }对此行的标记,方便在文中引用算法的某个步骤

\STATE Training ensemble of classifiers $E$ on $T_n cup P_n$, with help of data in former batches; label{code:fram:trainbase}

\STATE $E_n=E_{n-1}cup E$; label{code:fram:add}

\STATE Classifying samples in $U_n-T_n$ by $E_n$; label{code:fram:classify}

\STATE Deleting some weak classifiers in $E_n$ so as to keep the capacity of $E_n$; label{code:fram:select}

\RETURN $E_n$; %算法的返回值

\end{algorithmic}

\end{algorithm}

排版效果图:

在文中对算法和算法的某个步骤的引用:Therefore, in step
ef{code:fram:extract} of algorithm
ef{alg:Framwork}, we extract $T_n$, a set of reliable negative samples

1、 For和While循环语句的排版举例

(1) 排版效果图

(2)排版代码

\begin{algorithm}[h]

\caption{An example for format For & While Loop in Algorithm}

\begin{algorithmic}[1]

\FOR{each $iin [1,9]$}

\STATE initialize a tree $T_{i}$ with only a leaf (the root);\

\STATE $T=Tigcup T_{i};$\

\ENDFOR

\FORALL {$c$ such that $cin RecentMBatch(E_{n-1})$} label{code:TrainBase:getc}

\STATE $T=T cup PosSample(c)$; label{code:TrainBase:pos}

\ENDFOR;

\FOR{$i=1$; $i<n$; $i++$ }

\STATE $//$ Your source here;

\ENDFOR

\FOR{$i=1$ to $n$}

\STATE $//$ Your source here;

\ENDFOR

\STATE $//$ Reusing recent base classifiers. label{code:recentStart}

\WHILE {$(|E_n| leq L_1 )and( D
\eq phi)$}

\STATE Selecting the most recent classifier $c_i$ from $D$;

\STATE $D=D-c_i$;

\STATE $E_n=E_n+c_i$;

\ENDWHILE label{code:recentEnd}

\end{algorithmic}

\end{algorithm}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Im2latex是一种将图像转换为LaTeX代码的技术。LaTeX是一种用于排版科技文档的标记语言,它具有强大的数学公式排版功能。然而,对于不熟悉LaTeX的人来说,编写数学公式可能是一个繁琐的过程。 Im2latex通过使用深度学习和计算机视觉算法,可以将输入的数学公式图像转换为相应的LaTeX代码。它的工作原理是将图像分解为其基本元素,如数学符号和运算符,然后将它们映射到LaTeX代码。这样,用户就不需要手动输入和编辑LaTeX代码来排版数学公式,从而大大提高了工作的效率和准确性。 使用Im2latex可以帮助学生、研究者和教师更方便地生成和编辑复杂的数学公式。他们只需要拍摄数学公式的照片或将其上传到Im2latex的网站或应用程序中,然后就可以获取相应的LaTeX代码。这使得在科研论文、学术报告和数学教学中使用数学公式变得更加容易。 然而,Im2latex仍然有一些挑战。由于数学公式的复杂性和多样性,准确识别和转换所有类型的数学公式仍然是一个困难的问题。此外,对于涉及手写数学公式的图像,Im2latex的准确性可能会受到书写风格和字体选择的影响。 总的来说,Im2latex是一种将图像转换为LaTeX代码的有用工具。它可以帮助用户更轻松地生成和编辑数学公式,为科研和教学工作提供便利。随着深度学习和计算机视觉技术的发展,我们相信Im2latex将继续改进和完善,成为更实用的工具。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值