缺失 } 插入 \begin{equation}

缺失 } 插入 \begin{equation}

Missing } inserted \begin{equation}在这段代码中有一个:

\paragraph{任务约束} \begin{equation} \label{c1} \sum_{k \in K} y_{i}^{k}\leq 1 ~~ i \in I \end{equation}

我发现当我删除 \paragraph{Task/Technician Constraints} 时它可以起作用。请提供任何建议。在日志文件中:

! Missing } inserted.
<inserted text> 
                }
\begin{equation}
            \label{c1}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

答案1

该错误表明在方程式之前有某些东西抓住了\begin{equation}并产生了与方程式无关的错误(TeX 尚未读取)。

例如,以下文档产生了所显示的错误(并且任何产生此错误的文档基本上是等效的。

$ pdflatex file
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./file.tex
LaTeX2e <2017-12-01> patch level 99
Babel <3.15> and hyphenation patterns for 84 language(s) loaded.
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/size10.clo)) (./file.aux)
! Missing } inserted.
<inserted text> 
                }
l.8 \begin{equation}
                     \label{c1}
? h
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

来自

\documentclass{article}

\newcommand\zz[2]{\begingroup{\endgroup}}
\begin{document}


\zz
\begin{equation} \label{c1}
 \sum_{k \in K} y_{i}^{k}\leq 1  ~~ i \in I
\end{equation}
\end{document}

答案2

建议:尝试注释掉此代码块(即,将此代码块全部注释),然后编译。如果仍然有错误 - 那么问题就是其他地方缺少分隔符。

另请注意,~ 不适合在方程式内使用,应改用“\sim”。

相关内容