我正在使用算法包,阅读后知道可以\function
使用。我想让我的输出看起来像这样:
函数 d = 点积(x,y)。
我怎样才能做到这一点?
这就是我目前所拥有的
\Function {par-dot-prod}{x,y}
使用的软件包:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage{tabu}
\usepackage{comment}
\usepackage{amsmath}
%for the pseudo code
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
....
and partial code
\begin{algorithm}
\renewcommand{\thealgorithm}{2.a)}
\caption{Parallel Dot Product}
\begin{algorithmic}[1]
\Function {par-dot-prod}{x,y} \Comment{This is a test}
\State System Initialization
\State Read the value
\If{$condition = True$}
\State Do this
\If{$Condition \geq 1$}
\State Do that
\ElsIf{$Condition \neq 5$}
\State Do another
\State Do that as well
\Else
\State Do otherwise
\EndIf
\EndIf
\While{$something \not= 0$} \Comment{put some comments here}
\State $var1 \leftarrow var2$ \Comment{another comment}
\State $var3 \leftarrow var4$
\EndWhile \label{roy's loop}
\EndFunction
\end{algorithmic}
\end{algorithm}
}
答案1
我已经弄清楚了,所以我会告诉你们所有人,你们在做作业时可能会遇到或想要解决这个问题,并希望以这种方式格式化。
这是你必须做的:
将其放在文档的任何位置。
\algrenewcommand\textproc{}