\IF{<condition1>} <text1> \ELSIF{<condition2>} <text2> \ELSE <text3> \ENDIF 3. `for` Loop \FOR{<condition>} <text> \ENDFOR \FORALL{<condition>} <text> \ENDFOR \FOR{$i=0$ \TO $10$} \ENDFOR 4. `while` Loop \WHILE{<condition>} <text> \ENDWHILE 5. `repeat-until` L...
algorithmic 宏包主要是用来完成算法的描述功能,该宏包提供了我们描述算法常用的几种结构命令,如条件结构、循环结构等。下面我们就通过示例来对 algorithm 的使用进行讲解。 Algorithmic 环境 Algorithmic 宏包,为描述算法提供了程序设计中的所有常用结构的表示,如:判断 (IF) ,循环 (WHILE, FOR, LOOP), 输入(REQUIRE...
for Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.4The while Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.5The repeat-until Loop. . . . . . . . . . . . . . . . . . . . . . . .2.6...
其中 algorithm 宏包主要是为算法提供一个浮动体环境,也就是说,在 LaTeX 中算法和图像,表一样,都是浮动体。algorithmic 宏包主要是用来完成算法的描述功能,该宏包提供了我们描述算法常用的几种结构命令,如条件结构、循环结构等。下面我们就通过示例来对 algorithm 的使用进行讲解。 Algorithmic 环境 Algorithmic 宏包...
\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\; ...
% do nothing \else \unskip \addvspace{-1pt}% FUDGE to make the rules line up % draw a rule for each indent level \ALG@printindent@tempcnta=1 \loop \algrule[\csname ALG@ind@\the\ALG@printindent@tempcnta\endcsname]% \advance \ALG@printindent@tempcnta 1 \ifnum \ALG@printindent@te...
\documentclass{article} \usepackage{algorithm2e} \begin{document} \thispagestyle{empty} \SetKwFor{Loop}{Loop}{}{EndLoop} \begin{algorithm} \Loop{}{Statement\;Statement\;} \end{algorithm} \end{document} 原文:https://tex.stackexchange.com/questions/148414/infinite-loop-with-algorithm2e 好文...
2.3 The for Loop The for loop takes the forms. \FOR{} \ENDFOR \FORALL{} \ENDFOR For example, \begin{algorithmic} \FOR{$i=0$ to $10$} \STATE carry out some processing \ENDFOR \end{algorithmic} produces for i = 0 to 10 do 3 carry out some processing end for and \begin{algori...
LaTeX作为理工科科研人员的必备工具,熟练掌握可以极大地提高论文写作的效率。本文介绍了一个好用的工具包,帮助你优雅地书写伪代码。 1. 准备 该工具包的使用手册下载地址:http://mlg.ulb.ac.be/files/algorithm2e.pdf \usepackage[ruled,linesnumbered]{algo...
Latex写算法的伪代码排版 algorithmicx例子 相应代码: 1. \documentclass[11pt]{ctexart} 2. \usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry} 3. \usepackage{algorithm} 4. \usepackage{algorithmicx} 5. \usepackage{algpseudocode}...