出现错误“缺少 $ 插入”在乳胶中

发布于 2024-08-25 13:59:12 字数 957 浏览 4 评论 0 原文

我尝试在乳胶中编写以下内容:

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

由于某种原因,我收到了一堆错误。我认为“插入”这个词的使用是有道理的。我收到诸如“缺少插入的 $”之类的错误,因此解析似乎试图修复我的部分上的一些“错误”。我是否需要转义“插入”之类的词,我该怎么做?

I try to write the following in 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}

For some reason, I get a bunch of errors. I think there is something with the use of the word "insert". I get errors like "Missing $ inserted", so it seems like the parses tries to fix some "errors" on my parts. Do I need to escape words like "insert", how do I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

瞄了个咪的 2024-09-01 13:59:12

“插入缺失$”可能是由下划线和横杠引起的。 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 of update_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 \).

他夏了夏天 2024-09-01 13:59:12

其实就是下划线。使用 \_ 代替,或包含 下划线 包。

It's actually the underscores. Use \_ instead, or include the underscore package.

嘿哥们儿 2024-09-01 13:59:12

我也有这个问题。我通过删除方程式标记之间不必要的空行解决了这个问题。这给出了错误:

\begin{equation}
P(\underline{\hat{X}} | \underline{Y}) = ...

\end{equation}

虽然此代码编译成功:

\begin{equation}
P(\underline{\hat{X}} | \underline{Y}) = ...
\end{equation}

I had this problem too. I solved it by removing the unnecessary blank line between equation tags. This gives the error:

\begin{equation}
P(\underline{\hat{X}} | \underline{Y}) = ...

\end{equation}

while this code compiles succesfully:

\begin{equation}
P(\underline{\hat{X}} | \underline{Y}) = ...
\end{equation}
无需解释 2024-09-01 13:59:12

另外,我遇​​到了这个问题,但 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.

傻比既视感 2024-09-01 13:59:12

我遇到了同样的问题 - 我已经阅读了所有这些答案,但不幸的是它们都不适合我。最终我尝试删除这一行

%\usepackage[latin1]{inputenc}

,所有错误都消失了。

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

%\usepackage[latin1]{inputenc}

and all errors disappeared.

浮世清欢 2024-09-01 13:59:12

我的第一个猜测是 LaTeX 窒息了 |在数学环境之外。 缺少插入的 $ 通常是类似情况的症状。

My first guess is that LaTeX chokes on | outside a math environment. Missing $ inserted is usually a symptom of something like that.

风铃鹿 2024-09-01 13:59:12

如果您在数学模式之外使用特殊字符希腊字母(例如 \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.

倾城月光淡如水﹏ 2024-09-01 13:59:12

在我的代码中,当我收到错误时,我检查了可能的来源,在一行中,我输入了开头 \[ 和结尾 \] ,因此尽管我尝试对两个括号使用 $ ,但出现了缺少 $ 的错误。删除括号或使用 $[$ 而不是 $\[$ 解决了我的问题。如果你有类似的情况,请尝试改变。

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.

黑寡妇 2024-09-01 13:59:12

我认为它由于下划线符号而给出了错误。

注意:下划线不能直接写,必须写成\_

因此请修复这些特殊符号错误。

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.

醉南桥 2024-09-01 13:59:12

我的情况与 Adrian 的类似。这是一个写得不正确的在线参考书源。

我必须

 @online{some_pretty_website, 
    title={Pretty Website}, 
    url={https://www.prettywebsite.com/foo_bar.pdf}
 } 

转义网址中的“_”符号

 @online{some_pretty_website, 
    title={Pretty Website}, 
    url={https://www.prettywebsite.com/foo\_bar.pdf}
 } 

My case was similar to Adrian's. It was an incorrectly written online bib source.

I had

 @online{some_pretty_website, 
    title={Pretty Website}, 
    url={https://www.prettywebsite.com/foo_bar.pdf}
 } 

I had to escape the "_" symbol in the url

 @online{some_pretty_website, 
    title={Pretty Website}, 
    url={https://www.prettywebsite.com/foo\_bar.pdf}
 } 

遗失的美好 2024-09-01 13:59:12

我在一个表的头部有这个符号 _ 并且代码没有运行,所以我不得不删除。

I had this symbol _ in the head of one table and the code didn't run, so I had to delete.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文