我如何证明我对以下代码中内部 for 循环缩进的评论是合理的:
\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[caption=false,font=footnotesize]{subfig}
\begin{document}
\begin{algorithm} \label{algoQ}
\caption{Algorithm to check quality of methods}
\begin{algorithmic}
\For{\textbf{each} $methods$ in$methodList$}
\For{\textbf{each} $msd$ in$msdList$} \Comment { \% for each MSD \%}
\Statex \Comment { \% get MSDs referenced method service \%}
\EndFor \textbf{endFor}
\EndFor \textbf{endFor}
\end{algorithmic}
\end{algorithm}
\end{document}
答案1
你的问题不太清楚,你的意思是这样吗?
\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[caption=false,font=footnotesize]{subfig}
\begin{document}
\begin{algorithm} \label{algoQ}
\caption{Algorithm to check quality of methods}
\begin{algorithmic}
\For{\textbf{each} $methods$ in$methodList$}
\For{\textbf{each} $msd$ in$msdList$}
\Comment {\makebox[6.4cm][l]{ \% for each MSD \%}}
\Statex \Comment {\makebox[6.4cm][l]{ \% get MSDs referenced method service \%}}
\EndFor \textbf{endFor}
\EndFor \textbf{endFor}
\end{algorithmic}
\end{algorithm}
\end{document}