Latex: dollar sign in lstlising

I'm trying to put some asm code in a latex document, onfurtunatly pdflatex treats the $ characters in my document as mathematical env (which I don't want). On the other hand, I would still like to use this fantastic arrow (it uses env math to display it).

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

snap example:

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

Thanks for any help.

+3
source share
2 answers

You have a missing backslash. Try:

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

It was \hookleftarrowoutside the mathematical mode that caused the error.

+1
source

Use this:

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

: - , $, \ .

0

Source: https://habr.com/ru/post/1780381/


All Articles