Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Double hyphens in lstlisting

Tags:

latex

I am using lstlisting command in Latex. I want to use double hyphens "--help", but latex hyphens connects like in normal text (but it is source code) and I can't use "-{}-" for separation.

\begin{lstlisting} 
  $ oc <command> --help
\end{lstlisting}

Could you help me please? Thanks

like image 514
Azur Pazur Avatar asked Apr 08 '17 21:04

Azur Pazur


1 Answers

Seeing as you're using a terminal-like code display, consider using a \ttfamily as your basicstyle:

enter image description here

\documentclass{article}

\usepackage{listings}
\lstset{basicstyle=\ttfamily}

\begin{document}

\begin{lstlisting} 
$ oc <command> --help
\end{lstlisting}

\end{document}
like image 185
Werner Avatar answered Nov 09 '22 21:11

Werner