목록 패키지가 포함된 다채로운 사전 및 사후 토큰

목록 패키지가 포함된 다채로운 사전 및 사후 토큰

패키지 로 다채로운 토큰 prebreak과 토큰을 얻고 싶지만 다음 코드가 작동하지 않습니다.postbreaklistings

\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}

관련 정보