我想获得带有包的彩色prebreak
和postbreak
代币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}