出现错误“缺少 $ 插入”在乳胶中
我尝试在乳胶中编写以下内容:
\begin{itemize}
\item \textbf{insert(element|text)} inserts the element or text passed at the start of the selection.
\item \textbf{insert_after(element|text)} inserts the element or text passed at the end of the selection.
\item \textbf{replace(element|text)} replaces the selection with the passed text/element.
\item \textbf{delete()} deletes the selected text.
\item \textbf{annotate(name,value)} annotates the selected text with the passed name and value-pair. This can either be a hidden meta-data about the selection, or can alter the visible appearance.
\item \textbf{clear_annotation()} removes any annotation for this specific selection.
\item \textbf{update_element(value)} performs an update of the element at the selection with the passed value.
\end{itemize}
由于某种原因,我收到了一堆错误。我认为“插入”这个词的使用是有道理的。我收到诸如“缺少插入的 $”之类的错误,因此解析似乎试图修复我的部分上的一些“错误”。我是否需要转义“插入”之类的词,我该怎么做?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
“插入缺失$”可能是由下划线和横杠引起的。 LaTeX 中的这些字符在数学模式下具有特殊含义(由
$
字符分隔)。尝试逃离他们;例如update\_element
而不是update_element
。但是,如果您尝试显示代码,更好的解决方案是使用
\verb
命令,它将以等宽字体排版文本,并自动正确处理下划线和横线(无需使用\
转义它们)。The "Missing $ inserted" is probably caused by the underscores and bars. These characters in LaTeX have special meaning in math mode (which is delimited by
$
characters). Try escaping them; e.g.update\_element
instead ofupdate_element
.However, if you're trying to display code, a better solution would be to use the
\verb
command, which will typeset the text in a monospaced font and will automatically handle underscores and bars correctly (no need to escape them with\
).其实就是下划线。使用
\_
代替,或包含 下划线 包。It's actually the underscores. Use
\_
instead, or include the underscore package.我也有这个问题。我通过删除方程式标记之间不必要的空行解决了这个问题。这给出了错误:
虽然此代码编译成功:
I had this problem too. I solved it by removing the unnecessary blank line between equation tags. This gives the error:
while this code compiles succesfully:
另外,我遇到了这个问题,但 bib 文件无法重新编译。我删除了问题,即注释字段中的下划线,并再次编译了 tex 文件,但仍然出现相同的错误。最后我删除了编译好的围脖文件(我认为是.bbl)并且它工作得很好。我必须使用反斜杠转义 _ 。
also, I had this problem but the bib file wouldn't recompile. I removed the problem, which was an underscore in the note field, and compiled the tex file again, but kept getting the same errors. In the end I del'd the compiled bib file (.bbl I think) and it worked fine. I had to escape the _ using a backslash.
我遇到了同样的问题 - 我已经阅读了所有这些答案,但不幸的是它们都不适合我。最终我尝试删除这一行
,所有错误都消失了。
I had the same problem - and I have read all these answers, but unfortunately none of them worked for me. Eventually I tried removing this line
and all errors disappeared.
我的第一个猜测是 LaTeX 窒息了 |在数学环境之外。 缺少插入的 $ 通常是类似情况的症状。
My first guess is that LaTeX chokes on | outside a math environment. Missing $ inserted is usually a symptom of something like that.
如果您在数学模式之外使用特殊字符希腊字母(例如 \alpha \beta 等),您也可能会收到此错误。
当我将它们包裹在 \(...\) 中后,错误就消失了。
You can also get this error if you use special character greek letters like \alpha \beta and so on outside of math mode.
After i wrapped them in \(...\) the error was gone.
在我的代码中,当我收到错误时,我检查了可能的来源,在一行中,我输入了开头
\[
和结尾\]
,因此尽管我尝试对两个括号使用$
,但出现了缺少$
的错误。删除括号或使用$[$
而不是$\[$
解决了我的问题。如果你有类似的情况,请尝试改变。In my code, when I got the error, I checked the possible source, In a line, I had typed a beginning
\[
and an ending\]
due to which the error of missing$
appeared though I tried using$
for both the brackets. Removing the brackets or using$[$
instead of$\[$
solved my problem. If you've something like that, try altering.我认为它由于下划线符号而给出了错误。
注意:下划线不能直接写,必须写成
\_
。因此请修复这些特殊符号错误。
I think it gives the error because of the underscore symbol.
Note : underscore symbol should not be written directly, you have to write like as
\_
.So fix these kind special symbol errors.
我的情况与 Adrian 的类似。这是一个写得不正确的在线参考书源。
我必须
转义网址中的“_”符号
My case was similar to Adrian's. It was an incorrectly written online bib source.
I had
I had to escape the "_" symbol in the url
我在一个表的头部有这个符号
_
并且代码没有运行,所以我不得不删除。I had this symbol
_
in the head of one table and the code didn't run, so I had to delete.