【问题标题】:Double hyphens in lstlistinglstlisting 中的双连字符
【发布时间】:2017-04-08 21:21:26
【问题描述】:

我在 Latex 中使用 lstlisting 命令。我想使用双连字符“--help”,但乳胶连字符像普通文本一样连接(但它是源代码),我不能使用“-{}-”进行分隔。

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

你能帮帮我吗? 谢谢

【问题讨论】:

标签: latex


【解决方案1】:

鉴于您正在使用类似终端的代码显示,请考虑使用\ttfamily 作为您的basicstyle

\documentclass{article}

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

\begin{document}

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

\end{document}

【讨论】:

  • 非常感谢 :)
猜你喜欢
  • 2021-04-15
  • 1970-01-01
  • 2011-05-25
  • 2019-11-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-22
相关资源
最近更新 更多