Latex编辑算法伪代码示例
2018-04-05 20:28
1771 查看
伪代码:[plain] view plain copy\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}
输出结果:
\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编辑算法伪代码
- 最新用php获取谷歌PR值算法,附上php查询PR值代码示例
- 如何让DIV可编辑、可拖动示例代码
- Jquery可编辑的表格示例代码
- Latex文档中算法的编辑和visio图的插入
- STL(七):剩下5种算法代码分析与使用示例(remove 、rotate 、sort、lower_bound、accumulate)
- PCA 降维算法详解 以及代码示例
- PCA 降维算法详解 以及代码示例
- 皮肤检测算法三种,示例与代码
- Latex写算法的伪代码排版
- js 使FORM表单的所有元素不可编辑的示例代码
- Luhn算法学习及其Ruby版实现代码示例
- PCA 降维算法详解 以及代码示例
- 从零开始学C++之STL(七):剩下5种算法代码分析与使用示例(remove 、rotate 、sort、lower_bound、accumulate)
- Latex写算法的伪代码排版
- surf匹配算法opencv示例代码
- 人脸姿态校正算法 附完整C++示例代码
- LaTex中英文简历代码示例