咔片PPT · AI自动生成演示文稿,模板丰富、排版精美 讯飞智文 · 一键生成PPT和Word,高效应对学习与办公

内容导航:


一、如何在word文档中添加伪代码


Word中使用Aurora插入算法伪代码


1. properties-->packages
usepackage{amsmath}
usepackage{amssymb}
usepackage{amsfonts}
usepackage{mathrsfs}
usepackage{algorithm}
usepackage{algorithmic}
usepackage{multirow}
alglanguage{pseudocode}
% usepackage{euler}
providecommand{abs}[1]{leftlvert#1rightrvert}
providecommand{norm}[1]{leftlVert#1rightrVert}

2. insert latex code
renewcommand{algorithmicrequire}{textbf{Input:}}
renewcommand{algorithmicensure}{textbf{Initialization:}}
renewcommand{algorithmiclastcon}{textbf{Output:}}
algsetup{indent=2em}
begin{algorithm}[H]
caption{Likelihood free rejection sampler}
label{ABCLFRS}

begin{algorithmic}[1]
REQUIRE
ENSURE $y = x^n
% State $y Leftarrow 1 $ ~~\
% FOR {i=1 to N}$ ~~\
% REPEAT $
% STATE aa$ \
% UNTIL {}$
%
% ENDFOR ~~\

$
WHILE {$i leq 10$}
STATE i=i+1;
ENDWHILE $
lastcon ~~\
aa
end{algorithmic}
end{algorithm}
3. 算法编号
algorithm number Options chapter nothing

numberwithin{algorithm}{chapter}
or
renewcommand{thealgorithm}{arabic{chapter}.arabic{algorithm}}
or
renewcommand{thealgorithm}{}


二、如何在word文档里面插入漂亮的伪代码


Word中使用Aurora插入算法伪代码

1. properties-->packages
usepackage{amsmath}
usepackage{amssymb}
usepackage{amsfonts}
usepackage{mathrsfs}
usepackage{algorithm}
usepackage{algorithmic}
usepackage{multirow}
alglanguage{pseudocode}
% usepackage{euler}
providecommand{abs}[1]{leftlvert#1rightrvert}
providecommand{norm}[1]{leftlVert#1rightrVert}

2. insert latex code
renewcommand{algorithmicrequire}{textbf{Input:}}
renewcommand{algorithmicensure}{textbf{Initialization:}}
renewcommand{algorithmiclastcon}{textbf{Output:}}
algsetup{indent=2em}
begin{algorithm}[H]
caption{Likelihood free rejection sampler}
label{ABCLFRS}

begin{algorithmic}[1]
REQUIRE
ENSURE $y = x^n
% State $y Leftarrow 1 $ ~~\
% FOR {i=1 to N}$ ~~\
% REPEAT $
% STATE aa$ \
% UNTIL {}$
%
% ENDFOR ~~\

$
WHILE {$i leq 10$}
STATE i=i+1;
ENDWHILE $
lastcon ~~\
aa
end{algorithmic}
end{algorithm}
3. 算法编号
algorithm number Options chapter nothing

numberwithin{algorithm}{chapter}
or
renewcommand{thealgorithm}{arabic{chapter}.arabic{algorithm}}
or
renewcommand{thealgorithm}{}