我正在使用 {algorithm}、{algorithmic} 和 {algpseudocode} 包在 latex 上编写一个算法,并在伪代码的开头和结尾放置零数(0:):
\begin{algorithm}[!htbp]
\begin{algorithmic}
\begin{ALC@g}
\If { ['part\_neg'] tag is existing at PoS\_Tags[sentence]}
\begin{ALC@g}
\STATE NFR\_Score[sentence] = +1
\STATE NFR\_CF [sentence] = Maximum (NFR\_CF [sentence], 0. 8266)
\end{ALC@g}
\EndIf
\end{ALC@g}
\end{algorithmic}
\end{algorithm}
答案1
不要将algorithmic
和algpseudocode
一起加载,也不要混合语法:\If
isalgpseudocode
和\STATE
is algorithmic
。
没有必要使用ALG@c
(而且有害)。
\documentclass{article}
\usepackage{algorithm,algorithmic}
\begin{document}
\begin{algorithm}[!htbp]
\begin{algorithmic}
\IF {['part\_neg'] tag is existing at PoS\_Tags[sentence]}
\STATE NFR\_Score[sentence] = +1
\STATE NFR\_CF [sentence] = Maximum (NFR\_CF [sentence], 0. 8266)
\ENDIF
\end{algorithmic}
\end{algorithm}
\end{document}