这是 Pragmatic Bookshelf 书中的屏幕截图。
http://img13.imageshack.us/img13/3168/screenshot20100717at123.png
看起来像带有着色的逐字环境,但我不确定。
如图所示,如何将颜色逐字用于环境?
使用逐行方法将是一个解决方案,但我希望有更好的方法。
{\color{红色}\begin{逐字}
1号线
2号线
\end{逐字}}
\color{蓝色}{\begin{逐字}
3号线
4号线
\end{逐字}}
最佳答案
一个使用fancyvbr包的例子
\documentclass[a4paper,10pt]{scrartcl}
\usepackage{color}
\usepackage[utf8]{inputenc}
\usepackage{fancyvrb}
\usepackage[usenames,dvipsnames]{xcolor}
\fvset{frame=single,framesep=1mm,fontfamily=courier,fontsize=\scriptsize,numbers=left,framerule=.3mm,numbersep=1mm,commandchars=\\\{\}}
\begin{document}
\begin{Verbatim}[label={My orange command sample output}]
# \textcolor{Orange}{My orange command}
My black output
that it can be
many lines long
but this specific \textbf{\textcolor{OliveGreen}{word}}
and the following 2
\textbf{\textcolor{red}{lines are important so they}}
\textbf{\textcolor{red}{need to be highlighted and bold}}
\end{Verbatim}
\end{document}
关于latex - 逐字着色环境?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3272903/