本身algorithmicx 不带Parameter标签,因此只能利用algnewcommand命令创造这一个标签:
algnewcommandalgorithmicparam{ extbf{Parameter:}}
algnewcommandParam{item[algorithmicparam]}
这些定义要在egin{document}
之前,然后在伪代码中这样调用:
documentclass[a4paper,11pt]{article}
usepackage{algorithmicx}
usepackage{algorithm}
usepackage{algpseudocode}
algnewcommandalgorithmicparam{ extbf{Parameter:}}
algnewcommandParam{item[algorithmicparam]}
egin{document}
egin{algorithmic}[1]
Require $xge5$
Param y
Ensure $xle-5$
Statex
While{$x>-5$}
State $xgets x-1 + y$
EndWhile
end{algorithmic}
end{document}