各位大神,如何在word文档里面插入漂亮的伪代码
发布网友
发布时间:2022-04-23 19:05
我来回答
共1个回答
热心网友
时间:2023-10-14 03:34
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]{\left\lvert#1\right\rvert}
\providecommand{\norm}[1]{\left\lVert#1\right\rVert}
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 {<a=b>}$
%
% \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}{}