简体   繁体   English

在默认的乳胶模式emacs $字符中断颜色

[英]In default latex-mode emacs $ character break color

I need to include HTML code in LaTeX and I'm using the listings package for that. 我需要在LaTeX中包含HTML代码,并且为此使用了listings包。 The problem is that if there is a $ character in my HTML code the color of the word after $ is broken in Emacs. 问题是,如果我的HTML代码中有$字符,则Emacs中$后面的单词颜色会损坏。 To get the correct color I need to use another $ . 要获得正确的颜色,我需要使用另一个$

For example: 例如:

\begin{lstlisting}
    var mapElement = $("#map")[0];

    var mapOptions = {
        center: new google.maps.LatLng(43.720741,10.408413),
        zoom: 10
    };
\end{lstlisting}

After the $ character the text in the rest of the document isn't highlighted correctly. $字符之后,文档其余部分中的文本未正确突出显示。 I'm not using AUCTeX but the default latex-mode of Emacs. 我没有使用AUCTeX,而是使用了Emacs的默认latex-mode

Any ideas? 有任何想法吗?

I had the same problem and found a nice work around at http://www.latex-community.org/forum/viewtopic.php?f=31&t=25036 我遇到了同样的问题,并在http://www.latex-community.org/forum/viewtopic.php?f=31&t=25036找到了不错的解决方法

Use the following to output a $ each time you type 4> in the Latex code: 每次在Latex代码中键入4> ,使用以下命令输出$

\lstset{
        literate={4>}{\$}1
}

then put your listing code in as normal 然后像往常一样放入您的清单代码

\begin{lstlisting}
  ruby -e "4>(curl -fsSL\ https://raw.github.com/Homebrew/homebrew/go/install)"
\end{lstlisting}

which will work around highlighting issues and AucTeX will still look nice and pretty! 它可以解决突出问题,而AucTeX仍然看起来不错! (: (:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM