![我的算法开始和结束时的零号纸](https://linux22.com/image/452379/%E6%88%91%E7%9A%84%E7%AE%97%E6%B3%95%E5%BC%80%E5%A7%8B%E5%92%8C%E7%BB%93%E6%9D%9F%E6%97%B6%E7%9A%84%E9%9B%B6%E5%8F%B7%E7%BA%B8.png)
我正在使用 {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}