获取Emacs忽略Sweave文档中的\Sexpr {}命令的内容,以防止错误的基于$的语法突出显示 [英] Get Emacs to ignore contents of \Sexpr{} command in Sweave document to prevent incorrect $-based syntax highlighting

查看:115
本文介绍了获取Emacs忽略Sweave文档中的\Sexpr {}命令的内容,以防止错误的基于$的语法突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在LaTeX中编辑Sweave文档(使用Noweb模式)时,Emacs知道忽略<< >> =块中的代码。但是,对于插页式\Sexpr {}块,情况并非如此。由于列的引用通过'$'和LaTeX使用$来排除方程式,这些\Sexpr {}块通常会打破语法突出显示,如下所示:





我有一个非常初步的了解elisp& Emacs语法突出显示,但我希望可能添加一些.emacs将禁用\Sexpr {}中的任何解析/ $检测。

解决方案

我以为ESS的emacs有正确的语法突出显示Sweave?



<无论如何,最简单的修复只是不使用 $ 运算符,而是 [[例如:

  foo $ p.value 
foo [['p.value']]

应该提供相同的结果。我认为 foo $ p.value 只是 foo [[p.value,exact = FALSE]]的缩写]


When editing an Sweave document in LaTeX (using the Noweb mode), Emacs knows to "ignore" code that is in <<>>= blocks. However, for interstitial \Sexpr{} blocks, this isn't the case. Given that R references by columns via '$' and LaTeX uses $ to set-off equations, these \Sexpr{} blocks often break the syntax highlighting, like so:

I have a very rudimentary understanding the elisp & Emacs syntax highlighting, but my hope is that it might be possible to add something to .emacs that will disable any parsing/$ detection within \Sexpr{}'s.

解决方案

I thought emacs with ESS has correct syntax highlighting for Sweave?

Anyway, the easiest "fix" is to just not use the $ operator but [[ instead. For example:

foo$p.value
foo[['p.value']]

Should give the same result. I think foo$p.value is just short for foo[["p.value",exact=FALSE]]

这篇关于获取Emacs忽略Sweave文档中的\Sexpr {}命令的内容,以防止错误的基于$的语法突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆