![如何绘制彩色文本、多行、等宽](https://linux22.com/image/388077/%E5%A6%82%E4%BD%95%E7%BB%98%E5%88%B6%E5%BD%A9%E8%89%B2%E6%96%87%E6%9C%AC%E3%80%81%E5%A4%9A%E8%A1%8C%E3%80%81%E7%AD%89%E5%AE%BD.png)
想知道如何使用不同的颜色(例如每个字母不同的颜色)来绘制它,以便它在文档中显示如下:
/ \ / ___| / ___|_ _|_ _| / _ \ \___ \| | | | | | / ___ \ ___)| |___ | | | | /_/ \_\____/ \____|___|___|
但是 A 是蓝色,S 是红色,等等。
答案1
\documentclass{article}
\usepackage{color}
\catcode`!=13
\def!#1!{\color{#1}}
\begin{document}
\begin{verbatim}
!red! / \ !blue!/ ___| !green! / ___|!yellow!|_ _|!cyan!|_ _|
!red! / _ \ !blue!\___ \ !green!| | !yellow! | | !cyan! | |
!red! / ___ \ !blue! ___) |!green!| |___ !yellow! | | !cyan! | |
!red!/_/ \_\!blue!\____/ !green! \____|!yellow!|___|!cyan!|___|
\end{verbatim}
\end{document}