如何更改“算法包”中预定的命令“Require”。
我想写输入代替要求
这是我的代码:
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage[utf8]{inputenc}
\usepackage{algorithm}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithm}
\begin{algorithmic}
\Require Instead of write Require I want to write \textbf{Input}
\While{$N \neq 0$}\
Output $ =$ Content
\EndWhile\\
\end{algorithmic}
\end{algorithm}
\end{document}
答案1
请尝试以下操作:
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage[utf8]{inputenc}
\usepackage{algorithm}
\usepackage{algpseudocode}
\renewcommand{\algorithmicrequire}{\textbf{Input:}} %% <--
\begin{document}
\begin{algorithm}
\begin{algorithmic}
\Require Instead of write Require I want to write \textbf{Input}
\While{$N \neq 0$}\
Output $=$ Content
\EndWhile
\end{algorithmic}
\end{algorithm}
\end{document}