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?
Asked
Active
Viewed 7,657 times
9
karlkoeller
- 124,410
Dr.PB
- 767
1 Answers
7
Use the command \SetNoFillComment locally inside an algorithm environment or use the global option nofillcomment when loading algorithm2e.
MWE (borrowed from the linked answer):
\documentclass{article}
\usepackage{xcolor}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\newcommand\mycommfont[1]{\footnotesize\ttfamily\textcolor{blue}{#1}}
\SetCommentSty{mycommfont}
\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:
karlkoeller
- 124,410
