数学模式下的命令警告

数学模式下的命令警告

我收到此代码的警告:

\begin{itemize}
    \item $U'_0$, $all$, and $all'$.
    \item For all $1\leq i\leq n$ we have agents $x_i$ and $¬x_i$.
    \item For all $1\leq i\leq m$ we have agents $y_i$ and $¬y_i$.
    \item For all $1\leq j\leq k$ we have agent $c_j$.
    \item For all $1\leq i\leq n+m$ we have agent $col_i$.
\end{itemize}

我尝试添加但使用命令\usepackage{amsmath}时仍然收到警告。\leq

在此处输入图片描述

还需要其他库吗?

答案1

解决方法很简单:声明¬其行为如同\lnot在数学模式下一样。

\documentclass{article}

\DeclareUnicodeCharacter{00AC}{\TextOrMath{\textlnot}{\lnot}}

\begin{document}

\begin{itemize}
    \item $U'_0$, $\mathit{all}$, and $\mathit{all}'$.
    \item For all $1\leq i\leq n$ we have agents $x_i$ and $¬x_i$.
    \item For all $1\leq i\leq m$ we have agents $y_i$ and $¬y_i$.
    \item For all $1\leq j\leq k$ we have agent $c_j$.
    \item For all $1\leq i\leq n+m$ we have agent $\mathit{col}_i$.
\end{itemize}

\end{document}

我还添加了\mathit多字母标识符,因为我相信allcol应该是三个变量的乘法。

您也可以简单地重新声明

\DeclareUnicodeCharacter{00AC}{\lnot}

如果您希望符号仅出现在数学模式下,否则会引发错误。

在此处输入图片描述

答案2

对于这一具体案例,警告提及\textlnot[is] 在数学模式下无效。因此,请将其置于数学模式之外:

在此处输入图片描述

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{itemize}
  \item $U'_0$, $\mathrm{all}$, and $\mathrm{all}'$.
  \item For all $1 \leq i \leq n$ we have agents $x_i$ and ¬$x_i$.
  \item For all $1 \leq i \leq m$ we have agents $y_i$ and ¬$y_i$.
  \item For all $1 \leq j \leq k$ we have agent $c_j$.
  \item For all $1 \leq i \leq n + m$ we have agent $\mathrm{col}_i$.
\end{itemize}

\end{document}

但是,一般来说,您可以/应该使用\neg来否定布尔变量:

\begin{itemize}
  \item $U'_0$, $\mathrm{all}$, and $\mathrm{all}'$.
  \item For all $1 \leq i \leq n$ we have agents $x_i$ and $\neg x_i$.
  \item For all $1 \leq i \leq m$ we have agents $y_i$ and $\neg y_i$.
  \item For all $1 \leq j \leq k$ we have agent $c_j$.
  \item For all $1 \leq i \leq n + m$ we have agent $\mathrm{col}_i$.
\end{itemize}

相关内容