# algorithm2e compact \tcc comment

Here, the \tcc{iterate over all training examples} command, produces a large gap between examples and */. Left alignment is fine. But how to reduce the gap and make it compact?

Use the command \SetNoFillComment locally inside an algorithm environment or use the global option nofillcomment when loading algorithm2e.

\documentclass{article}
\usepackage{xcolor}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\newcommand\mycommfont[1]{\footnotesize\ttfamily\textcolor{blue}{#1}}

\begin{document}

\begin{algorithm}[H]
\DontPrintSemicolon
\SetNoFillComment % <---------------------------
\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}


Output: