乳胶中的数学方程(varnothing)

乳胶中的数学方程(varnothing)

在伪代码中,我想分配\varnothing给一个变量。
我的代码如下:

\documentclass[runningheads]{llncs} 
\usepackage{graphicx} 
\usepackage{algpseudocode} 
\usepackage{algorithm}
\usepackage{amsmath}
\begin{document}
\begin{algorithm} 
\caption{Find...} 
\begin{algorithmic}[1] \State $RS$ $\leftarrow$ $\varnothing$ \end{algorithmic} 
\end{algorithm} 
\end{document}

不幸的是,这不起作用。我收到的错误消息如下:

State $RS$ $\leftarrow \varnothing $ The control sequence at the end
of the top line of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct spelling
(e.g., `I\hbox'). Otherwise just continue, and I'll forget about
whatever was undefined. ! Undefined control sequence. 
\varnothing l.103 ...\quad \quad $R$ $\leftarrow$ $\varnothing $
\Comment{$R$ is the set ... The control sequence at the end of the top
line of your error message was never \def'ed. If you have misspelled
it (e.g., `\hobx'), type `I' and the correct spelling (e.g.,
`I\hbox'). Otherwise just continue, and I'll forget about whatever was
undefined.

您对如何解决这个问题有什么想法吗?

仅供参考,我已经在 Debian 9 中安装amsmathtexlive-latex-base

谢谢,
帕夫洛斯

答案1

\varnothing属于包中的符号集amssymb。因此,将其包含在您的序言中,\usepackage{amssymb}您就可以开始了。

\documentclass{article} 
\usepackage{graphicx} 
\usepackage{algpseudocode} 
\usepackage{algorithm}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
    \begin{algorithm} 
        \caption{Find...} 
        \begin{algorithmic}[1] \State $RS$ $\leftarrow$ $\varnothing$ \end{algorithmic} 
    \end{algorithm} 
\end{document}

您将获得:

在此处输入图片描述

相关内容