Inside the verbatim environment, is it possible to use a different color, please? For example, I want a
to be normal, i.e., black. But I want b
to be red.
\documentclass[]{article}
\begin{document}
\begin{verbatim}
a (black)
b (I want this letter to be red)
\end{verbatim}
\end{document}
Follow-up Question:
The solution provided by Ignasi was neat. However, there is a problem. If I need to write the entire verbatim in a non-black color, then it will not work.
\documentclass[]{article}
\usepackage{fancyvrb}
\usepackage{xcolor}
\begin{document}
I want the following to look exactly like the way I put, i.e., like an align. But it displays in one line. How to fix?
\begin{Verbatim}[commandchars=\\\{\}]
\textcolor{red}{
a = b + 1
= x + y
= s + t
= c - d
= o * p
}
\end{Verbatim}
\end{document}
fancyvrb
will do this See this : tex.stackexchange.com/questions/91259/…