Latex编辑算法伪代码示例
2016-12-05 22:30
2707 查看
伪代码:
\documentclass[11pt]{article}
\usepackage{CJK}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{amsmath}
\usepackage{amssymb}
\floatname{algorithm}{Algorithm}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\begin{document}
\begin{CJK*}{UTF8}{gkai}
%SetUp函数
\begin{algorithm}
\caption{AlgoName}
\begin{algorithmic}[1] %每行显示行号
\Require Input
\Ensure Output
\Function {"FuncName"}{}
%if
\If {"condition"} "text" \EndIf
\State
% if else
\If {"condition"} "text"
\Else "text"
\EndIf\State
%if elseif else
\If {"condition"} "text"
\ElsIf {"condition"} "text"
\Else "text"
\EndIf\State
%for
\For{"condition"} "text" \EndFor\State
%forall
\ForAll {"condition"} "text" \EndFor\State
%while
\While {"condition"} "text" \EndWhile\State
%repeat
\Repeat "text" \Until {"condition"}\State
%loop
\Loop "text" \EndLoop\State
%return
\Return $Result$
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{CJK*}
\end{document}
输出结果:
\documentclass[11pt]{article}
\usepackage{CJK}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{amsmath}
\usepackage{amssymb}
\floatname{algorithm}{Algorithm}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\begin{document}
\begin{CJK*}{UTF8}{gkai}
%SetUp函数
\begin{algorithm}
\caption{AlgoName}
\begin{algorithmic}[1] %每行显示行号
\Require Input
\Ensure Output
\Function {"FuncName"}{}
%if
\If {"condition"} "text" \EndIf
\State
% if else
\If {"condition"} "text"
\Else "text"
\EndIf\State
%if elseif else
\If {"condition"} "text"
\ElsIf {"condition"} "text"
\Else "text"
\EndIf\State
%for
\For{"condition"} "text" \EndFor\State
%forall
\ForAll {"condition"} "text" \EndFor\State
%while
\While {"condition"} "text" \EndWhile\State
%repeat
\Repeat "text" \Until {"condition"}\State
%loop
\Loop "text" \EndLoop\State
%return
\Return $Result$
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{CJK*}
\end{document}
输出结果:
相关文章推荐
- Latex编辑算法伪代码示例
- 使用Latex编辑算法伪代码
- Jquery可编辑的表格示例代码
- 最新用php获取谷歌PR值算法,附上php查询PR值代码示例
- Latex 算法编辑
- PCA 降维算法详解 以及代码示例
- PCA 降维算法详解 以及代码示例
- 嵌入式小波零树(EZW)算法的过程详解和Matlab代码(4)运行示例
- DFS BFS 示例 以及BFS部分算法代码
- 皮肤检测算法三种,示例与代码
- js 使FORM表单的所有元素不可编辑的示例代码
- C++之STL(七):剩下5种算法代码分析与使用示例(remove 、rotate 、sort、lower_bound、accumulate)
- 最新用php获取谷歌PR值算法,附上php查询PR值代码示例
- JS实现随机数生成算法示例代码
- 从零开始学C++之STL(七):剩下5种算法代码分析与使用示例(remove 、rotate 、sort、lower_bound、accumulate)
- Repeater控件实现编辑、更新、删除等操作示例代码
- 换零钱算法分析及代码示例
- 从零开始学C++之STL(七):剩下5种算法代码分析与使用示例(remove 、rotate 、sort、lower_bound、accumulate)
- 如何让DIV可编辑、可拖动示例代码
- java文本相似度计算(Levenshtein Distance算法(中文翻译:编辑距离算法))----代码和详解