latex实现伪代码算法(待完善)
来源:互联网 发布:sql server 2012和2008 编辑:程序博客网 时间:2024/06/13 07:04
1,不要自己去“造车轮子”,利用algorithmic, algorithmicx等宏包要省好多事。
algorithmic和algorithmicx
2,\label是放在\caption后面
介绍下algorithmic和algorithmicx,这两个包很像,很多命令都是一样的,只是algorithmic的命令都是大写,algorithmicx的命令都是首字母大写。
下面是algorithmic的基本命令
\STATE <text>\IF{<condition>} \STATE{<text>} \ENDIF\FOR{<condition>} \STATE{<text>} \ENDFOR\FOR{<condition> \TO <condition> } \STATE{<text>} \ENDFOR\FORALL{<condition>} \STATE{<text>} \ENDFOR\WHILE{<condition>} \STATE{<text>} \ENDWHILE\REPEAT \STATE{<text>} \UNTIL{<condition>}\LOOP \STATE{<text>} \ENDLOOP\REQUIRE <text>\ENSURE <text>\RETURN <text>\PRINT <text>\COMMENT{<text>}\AND, \OR, \XOR, \NOT, \TO, \TRUE, \FALSE
对比看一下,下面是algorithmicx包的基本命令
\State <text>\If{<condition>} <text> \EndIf\If{<condition>} <text> \Else <text> \EndIf\If{<condition>} <text> \ElsIf{<condition>} <text> \Else <text> \EndIf\For{<condition>} <text> \EndFor\ForAll{<condition>} <text> \EndFor\While{<condition>} <text> \EndWhile\Repeat <text> \Until{<condition>}\Loop <text> \EndLoop\Require <text>\Ensure <text>\Function{<name>}{<params>} <body> \EndFunction\State \Return <text>\Comment{<text>}
另外,还有3个修改algorithm标签,require标签,ensure标签显示的三个命令:
\floatname{algorithm}{算法}\renewcommand{\algorithmicrequire}{\textbf{输入:}} \renewcommand{\algorithmicensure}{\textbf{输出:}}
- 变量要用花体
- 需要有input,output
- 需要有行标
阅读全文
0 0
- latex实现伪代码算法(待完善)
- 各种经典排序算法的实现(待完善)
- 使用Latex编辑算法伪代码
- Latex写算法的伪代码排版
- Latex编辑算法伪代码示例
- Latex写算法的伪代码排版
- Latex写算法的伪代码排版
- 常见几种算法(待完善)
- 归并算法.(待完善)
- TDD表达式再次实现(待完善)
- 动态链表实现(待完善)
- latex插入伪代码
- Latex插入伪代码
- LaTeX/Algorithms 伪代码
- LaTeX写伪代码
- LaTeX/Algorithms 伪代码
- latex伪代码
- Latex 插入伪代码
- SQL LIKE(操作符)
- WebView的基础使用
- POCO库学习教程(一) windows POCO库编译(64位)
- Vue环境搭建
- Laravel 5.4 migrate时报错: Specified key was too long error
- latex实现伪代码算法(待完善)
- database:sql.js the note demo
- 加入购物车代码
- 支持向量机(一)
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)异常处理
- C++实现RTMP协议发送H.264编码及AAC编码的音视频
- windows使用jenkins部署到centos总结
- google chrome 官方下载安装的方法和离线包官方下载
- Apache CXF 框架结构和基本原理