丰富多彩的突破前和突破后代币及上市套餐

丰富多彩的突破前和突破后代币及上市套餐

我想获得带有包的彩色prebreakpostbreak代币listings,但是以下代码不起作用:

\documentclass{article}
\usepackage{xcolor,listings}
\begin{document}
\begin{lstlisting}[basicstyle=\ttfamily,breaklines,prebreak={\space\color{teal}!},postbreak={\color{blue}!\space}]
This is a long line. This is a long line. This is a long line. This is a long line. This is a long line.
This is another long line. This is another long line. This is another long line. This is another long line.
\end{lstlisting}
\end{document}

我该如何解决这个问题?

答案1

在此处输入图片描述

\documentclass{article}
\usepackage{xcolor,listings}
\begin{document}
\begin{lstlisting}[basicstyle=\ttfamily,breaklines,prebreak={\space\hbox{\textcolor{teal}{!}}},postbreak={\hbox{\textcolor{blue}{!}}\space}]
This is a long line. This is a long line. This is a long line. This is a long line. This is a long line.
This is another long line. This is another long line. This is another long line. This is another long line.
\end{lstlisting}
\end{document}

相关内容