这是Pragmatic Bookshelf书籍的屏幕截图.
http://img13.imageshack.us/img13/3168/screenshot20100717at123.png
它看起来像着色的逐字环境,但我不确定.
如何显示可以如何逐字逐句地使用颜色?
使用逐行方法将是一种解决方案,但我希望有更好的方法.
{\color{red}\begin{verbatim}
line 1
line 2
\end{verbatim} }
\color{blue}{\begin{verbatim}
line 3
line 4
\end{verbatim}}
Van*_*las 18
使用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}
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
14263 次 |
| 最近记录: |