而不是这个输出带有“蹲-u”空格符号
我想用例如替换它$\cdot$
。替换制表符的默认符号没有问题,但替换空格的默认符号没有问题吗?
\documentclass{article}
\PassOptionsToPackage{final}{listings}
\usepackage[%
,listings
]{tcolorbox}
\newtcblisting{codeexample}{%
listing only,
listing options = {%
showspaces=true,
showtabs=true,
tab=\rightarrowfill}
}
\begin{document}
XXX
\begin{codeexample}
Some text with spaces between words.
"what is a space"?
\end{codeexample}
XXX
\end{document}
答案1
您必须重新定义\lst@visiblespace
:
\def\lst@visiblespace{\lst@ttfamily{\char32}$\cdot$}
完整代码:
\documentclass{article}
\PassOptionsToPackage{final}{listings}
\usepackage[%
,listings
]{tcolorbox}
\makeatletter
\def\lst@visiblespace{\lst@ttfamily{\char32}$\cdot$}
\makeatother
\newtcblisting{codeexample}{%
listing only,
listing options = {%
showspaces=true,
showtabs=true,
tab=\rightarrowfill}
}
\begin{document}
XXX
\begin{codeexample}
Some text with spaces between words.
"what is a space"?
\end{codeexample}
XXX
\end{document}