Latex插入伪代码

来源:互联网 发布:淘宝海报背景素材 编辑:程序博客网 时间:2024/04/27 21:15

%\floatname{algorithm}{Alg. }%自己命名首行开头显示内容\renewcommand{\algorithmicrequire}{\textbf{Input:}}%Input\renewcommand{\algorithmicensure}{\textbf{Output:}}%Output\begin{center}\begin{minipage}{0.8\textwidth}%宽度调整\begin{algorithm}[H]%\footnotesize%字体大小\caption{One Greedy Algorithm}%首行显示算法名称\begin{algorithmic}[1]%行编号,从Input, Output后面开始\Require Point Set $P\subseteq \mathbb{R}^{d}$; the threshold $\delta$.%输入Input\Ensure A subset $U$ of $P$.                                           %输入Output\For{$t=1$ to $T$}\If {$t=1$}\State Initialize the classifier with parameter set $w_1$\ElsIf {$t=2$}\State Store target observation corresponding to $z_t$\Else\State $t\leftarrow t+1$\EndIf\EndFor\end{algorithmic}  \end{algorithm}\end{minipage}\end{center}

显示结果为


0 0