The following works:
\documentclass{article}
\usepackage{fancyvrb}
\usepackage{color}
\begin{document}
\begin{Verbatim}[commandchars=\\\{\}]
test\textcolor{red}{foo}test
\end{Verbatim}
\end{document}
but the following does not:
\documentclass{article}
\usepackage{fancyvrb}
\usepackage{color}
\begin{document}
\begin{Verbatim}[commandchars=&<>]
test&textcolor<red><foo>test
\end{Verbatim}
\end{document}
I get this error message:
ERROR: Argument of \textcolor has an extra }.
--- TeX said ---
<inserted text>
\par
l.7 test&textcolor<red><foo>test
--- HELP ---
From the .log file...
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
I've tried all combinations of backslash-escaping the command chars but no luck. How can I use &, <, and > as the command characters? (Or if it's not possible, why?)
<and>can't be used as delimiters infancyvrb? – Richard Hansen Jul 15 '11 at 16:38\ifnumor\ifdimis involved. – egreg Jul 15 '11 at 18:05commandcharsinVerbatim? – Tiina Apr 26 '18 at 03:04fancyvrb? – egreg Apr 26 '18 at 08:23Tex distributionI used tex maker so I should look up itshelp? it hasLaTeX2e reference manual (May 2013)but I am not sure if it includes every package. – Tiina Apr 27 '18 at 08:26