我的 LaTeX 代码有问题。我一直收到错误:
Underfull \vbox (badness 10000) has occurred while \output is active [13]
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.461 \end{algorithmic}
LaTeX 代码:
\documentclass{article}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{pifont}
\begin{document}
\begin{algorithm}
\caption{ glavna\_zanka }%function
\begin{algorithmic}[1]
\While{ končaj $\not=$ false }
\State $ rotiraj\_robota()$
\State obrobje o = $izberi\_raziskovalni\_cilj()$
\If { o $\neq$ null }
\State $ premakni\_do\_cilja(o)$
\Else
\State končaj = true
\EndIf
\EndWhile
\end{algorithmic}
\end{algorithm}
\begin{algorithm}
\caption{ izberi\_raziskovalni\_cilj() }
\begin{algorithmic}[1]
\end{algorithmic}
\end{algorithm}
\end{document}
我将非常感激您对这个问题的任何见解。
答案1
预期代码主体中有几行代码algorithmic
。请比较一个可编译的示例:
\documentclass{article}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{pifont}
\begin{document}
\begin{algorithm}
\caption{ glavna\_zanka }%function
\begin{algorithmic}[1]
\While{ končaj $\not=$ false }
\State $ rotiraj\_robota()$
\State obrobje o = $izberi\_raziskovalni\_cilj()$
\If { o $\neq$ null }
\State $ premakni\_do\_cilja(o)$
\Else
\State končaj = true
\EndIf
\EndWhile
\end{algorithmic}
\end{algorithm}
\begin{algorithm}
\caption{ izberi\_raziskovalni\_cilj() }
\begin{algorithmic}[1]
\While
\EndWhile
\end{algorithmic}
\end{algorithm}
\end{document}
顺便说一句:LaTeX Error: Something's wrong--perhaps a missing \item.
很少意味着缺少物品;至少根据我的经验。:-)
答案2
看来算法环境需要有一个内容:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{pifont}
\begin{document}
%
\begin{algorithm}
\caption{ glavna\_zanka }%function
\begin{algorithmic}[1]
\While{ končaj $\not=$ false }
\State $ rotiraj\_robota()$
\State obrobje o = $izberi\_raziskovalni\_cilj()$
\If { o $\neq$ null }
\State $ premakni\_do\_cilja(o)$
\Else
\State končaj = true
\EndIf
\EndWhile
\end{algorithmic}
\end{algorithm}
\begin{algorithm}
\caption{izberi\_raziskovalni\_cilj()}
\begin{algorithmic}[1]
\State Lalala…
\end{algorithmic}
\end{algorithm}
\end{document}