I wanted to know how to change the comment style in the algorithm2e package. I want to make my comments of a smaller font and a different color:
\documentclass{article}
\usepackage{color}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\begin{document}
\begin{algorithm}[H]
\DontPrintSemicolon
\CommentSty{\color{blue}}
\KwData{Training set $x$}
$\Delta_{ji}^l := 0$ \tcp*{will be used to compute $\partial x$}
\tcc{iterate over all training examples}
\caption{Example code}
\end{algorithm}
\end{document}
Best Answer
You need to define a command with an argument giving the font specification and then use the name of this command in the argument for
\SetCommentSty
: