首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >在LaTeX中出现错误"Missing $ inserted“

在LaTeX中出现错误"Missing $ inserted“
EN

Stack Overflow用户
提问于 2010-03-19 19:34:11
回答 7查看 462K关注 0票数 205

我尝试用latex编写以下代码:

\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}

由于某些原因,我得到了一堆错误。我认为“插入”这个词的用法是有道理的。我收到像"Missing $ inserted“这样的错误,所以解析器似乎试图修复我的部分上的一些”错误“。我需要转义像"insert“这样的词吗,我该怎么做?

EN

回答 7

Stack Overflow用户

回答已采纳

发布于 2010-03-19 19:41:16

“缺少$ inserted”可能是由下划线和横线引起的。在数学模式(由$字符分隔)中,LaTeX中的这些字符具有特殊含义。尝试对它们进行转义;例如,用update\_element代替update_element

但是,如果您试图显示代码,一个更好的解决方案是使用\verb command,它将以等宽字体排版文本,并自动正确地处理下划线和条形线(不需要使用\对它们进行转义)。

票数 363
EN

Stack Overflow用户

发布于 2016-05-12 06:16:17

我也有同样的问题--我已经阅读了所有这些答案,但不幸的是,它们都不适用于我。最后,我尝试删除这行代码

%\usepackage[latin1]{inputenc}

所有的错误都消失了。

票数 7
EN

Stack Overflow用户

发布于 2011-07-22 00:38:49

另外,我也遇到了这个问题,但是bib文件不能重新编译。我删除了这个问题,它是注释字段中的一个下划线,并再次编译了tex文件,但仍然得到相同的错误。最后,我解压了编译后的bib文件(我认为是.bbl),它工作得很好。我不得不用反斜杠来转义_。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2476831

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档