“$” noweb(文学编程)文件代码块中的符号

发布于 2024-10-06 21:30:26 字数 460 浏览 0 评论 0原文

我在 noweb(即 .nw)文件的代码块内有以下 javascript 代码:

<<tooltip>>=
$("span").tooltip({
   tip: 'tooltip',
   predelay: 30,
   delay: 3000,
   onShow: function(){}
});


@

生成的 javascript 代码是正确的。但是生成的latex文件是错误的。它说我缺少一个“$”符号(“!缺少插入$。”)。

在这种情况下,如何使用 noweave 生成​​正确的 .tex 文件?现在,我可以通过在“@”符号后面注释掉“$”符号来生成正确的 .tex 文件,也就是说,我用以下行替换上面示例中的最后一行。

@ %$

我还是觉得这个说法不够正确。它搞乱了 emacs 中的语法高亮显示。我很欣赏与此相关的任何意见,因为我刚刚开始喜欢文学编程的想法。

I have following javascript code inside a code chunk of a noweb (i.e., .nw) file:

<<tooltip>>=
$("span").tooltip({
   tip: 'tooltip',
   predelay: 30,
   delay: 3000,
   onShow: function(){}
});


@

The generated javascript code is correct. But the generated latex file is wrong. It says that I am missing a "$" symbol ("! Missing $ inserted.").

In this case, how can I generate a correct .tex file using noweave? For now I can generate the correct .tex file by a commented out "$" symbol after the "@" symbol, that is, I substitute the last line from the above example with the following line.

@ %$

I still feel this is not correct enough. It messes up the syntax highlighting in emacs. I appreciate any input regarding this as I am just beginning to like the idea of literate programming.

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

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

发布评论

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

评论(1

意中人 2024-10-13 21:30:26

你可以用 jQuery 替换 $ 符号

you can replace the $ symbol with jQuery

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