In my Verbatim I need to specify colour for my code.
In this answer (fancyvrb alternate commandchars and \textcolor) the solution is to put this code in the preamble:
\newcommand*{\fvtextcolor}[1]{\textcolor{#1}{#2}}
and then use
\begin{Verbatim}[commandchars=&\[\]]
&fvtextcolor[blue][function]
\end{Verbatim}
My problem is the commandchars
. \textcolor
needs a pair of braces, but in my code I use all the pair of braces that is: ()
[]
{}
.
So is it possible to specify another pair of commandchars
? Something like
&fvtextcolor'blue''function'
or &fvtextcolor"blue""function"
?
Best Answer
In theory, any unused characters would do, but unfortunately for certain characters this conflicts with other parts of
verbatim
typesetting.I've found out that
gives the expected result.
The characters that are likely not to work are
If you really need some of them, a workaround can be devised.