latex algorithm 怎么打

latex algorithm 怎么打,第1张

latex 写algorithm的方法:

algorithm排版可能需要的套件

\documentclass[journal]{IEEEtran}

\usepackage{algorithm}

%\usepackage{algorithmic}

\usepackage{algpseudocode}

\usepackage{amsmath}

\usepackage{graphics}

\usepackage{epsfig}

其中algorithmic在compile时会出现错误

! LaTex Error: Command \algorithm already defined.

Or name \end... illegal, see p.192 of the manual

原因不是很清楚,所以只好先mark掉.

在算法中显示Input 和Output 关键字:

\renewcommand{\algorithmicrequire}{\textbf{Input:}} % Use Input in the format of Algorithm

\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm

样式1:

\begin{algorithm}[htb]

\caption{ Framework of ensemble learning for our system.}

\label{alg:Framwork}

\begin{algorithmic}[1]

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

\Ensure

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}

\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}

要去掉Algorithm

1等自动产生的编号,需要对相应的.sty文件进行修改,难度比较大。修改\REQUIRE应该用\renewcommand{\algorithmicrequire}{\textbf{Input:}}。此外,你也可以试一下改用newalg宏包,那也主要是针对编辑程序伪代码的


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11719864.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存