Latex:lstlising 中的美元 $ 符号

发布于 2024-10-07 09:08:49 字数 423 浏览 0 评论 0原文

我试图将一些 asm 代码放入乳胶文档中,但 pdflatex 将我文档中的 $ 符号视为数学环境(我不想要)。另一方面,我仍然想使用那个花哨的换行箭头(它使用 math env 来显示它)。

\lstset{
texcl=false,
mathescape=false,
..,
prebreak = \raisebox{0ex}[0ex][0ex]{ensuremath{\hookleftarrow}}
}

示例快照:

CTRL_WD_12      equ     $303400
CTRL_WD_34      equ     $220000
CTRL_WD_56      equ     $000000
CTRL_WD_78      equ     $000000

感谢您的帮助。

I am trying to put some asm code into a latex document, onfurtunatly pdflatex treats the $ signs within my document as math env (which I do not want). On the other side I'd still like to use that fancy linebreak arrow (which uses math env to display it).

\lstset{
texcl=false,
mathescape=false,
..,
prebreak = \raisebox{0ex}[0ex][0ex]{ensuremath{\hookleftarrow}}
}

example snap:

CTRL_WD_12      equ     $303400
CTRL_WD_34      equ     $220000
CTRL_WD_56      equ     $000000
CTRL_WD_78      equ     $000000

thanks for any help.

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

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

发布评论

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

评论(2

无语# 2024-10-14 09:08:49

你缺少一个反斜杠。尝试:

prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}}

是数学模式之外的 \hookleftarrow 导致了错误。

You have a missing backslash. Try:

prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}}

It was the \hookleftarrow outside of math mode that was causing the error.

送君千里 2024-10-14 09:08:49

使用这个:

CTRL_WD_12      equ     \$303400
CTRL_WD_34      equ     \$220000
CTRL_WD_56      equ     \$000000
CTRL_WD_78      equ     \$000000

规则是:如果某个东西是特殊字符,例如 $ ,则反斜杠 \ 通常可以毫无问题地对其进行转义。

Use this:

CTRL_WD_12      equ     \$303400
CTRL_WD_34      equ     \$220000
CTRL_WD_56      equ     \$000000
CTRL_WD_78      equ     \$000000

The rule is: if something is a special character, like $ is, a backslash \ usually escapes it without problems.

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