
ここコマンドは、と\tcc{iterate over all training examples}
の間に大きな隙間を作ります。左揃えは問題ありません。しかし、隙間を小さくしてコンパクトにするにはどうすればよいでしょうか。examples
*/
答え1
\SetNoFillComment
環境内でローカルにコマンドを使用するか、ロード時にalgorithm
グローバル オプションを使用します。nofillcomment
algorithm2e
MWE (リンク先の回答から借用):
\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}
出力: