Latex((缺失数字,视为零。))

Latex((缺失数字,视为零。))
 \begin{eqnarray*}
  % \nonumber % Remove numbering (before each equation)
    (a, b) &=& \{ x \in X | a < x < b \} \\
    (a, b] &=& \{ x \in X | a < x \leq b \} \\
    [a, b) &=& \{ x \in X | a \leq x < b\} \\
    [a, b] &=& \{ x \in X | a \leq x \leq b \}.
  \end{eqnarray*}

什么错误?

 Missing number, treated as zero.
<to be read again> 
                   a
l.281     [a, b]
                 &=& \{ x \in X \mid a \leq x \leq b \}.

答案1

您的问题性质类似于:

...即使在这种情况下你使用的是eqnarray。你必须避免\\抓住[下一行的后续内容并认为它需要一个可选参数。使用\\relax{}[a,b)

在此处输入图片描述

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align*}
  (a, b) &= \{ x \in X \mid a < x < b \}       \\
  (a, b] &= \{ x \in X \mid a < x \leq b \}    \\\relax
  [a, b) &= \{ x \in X \mid a \leq x < b\}     \\\relax
  [a, b] &= \{ x \in X \mid a \leq x \leq b \}.
\end{align*}

\end{document}

您还可以使用interval包裹指定间隔,这将删除逐字使用[换行符\\,而是使用宏来设置间隔:

\documentclass{article}

\usepackage{amsmath,interval}

\intervalconfig{
  soft open fences % Uses ( and ) for open intervals, rather than ] and [
}

\begin{document}

\begin{align*}
  \interval[open left, open right]{a}{b} &= \{ x \in X \mid a < x < b \}        \\
              \interval[open left]{a}{b} &= \{ x \in X \mid a < x \leq b \}     \\
             \interval[open right]{a}{b} &= \{ x \in X \mid a \leq x < b\}      \\
                         \interval{a}{b} &= \{ x \in X \mid a \leq x \leq b \}.
\end{align*}

\end{document}

相关内容