\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{multirow}
\setlength{\textfloatsep}{0.1cm}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}
\begin{algorithm}
\caption{Validation Algorithm}
\begin{algorithmic}[1]
\FORALL{r in Requirements}
\FORALL{m in Methods}
\item OutputPredicted= TraceRefiner(r, m)
\IF {m.GoldStandard[r]==m.Trace[r]}
\IF {m.GoldStandard[r]==T}
\RETURN TP
\ELSIF {m.GoldStandard[r]==N}
\RETURN TN
\ENDIF
\ELSE
\IF {m.GoldStandard[r]==N \AND
OutputPredicted.Value==T}
\RETURN FP
\ELSIF {m.GoldStandard[r]==T \AND
OutputPredicted.Value==N}
\RETURN FN
\ELSE
\RETURN E
\ENDIF
\ENDIF
\ENDFOR
\ENDFOR
\end{algorithmic}
\label{alg:ValidationAlgo}
\end{algorithm}
\end{document}
答案1
出现大空格是因为 tex 试图对齐自动换行的行。为了避免这种情况,请\flushleft
在算法前添加:
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{multirow}
\setlength{\textfloatsep}{0.1cm}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}
\begin{algorithm}
\caption{Validation Algorithm}
\flushleft
\begin{algorithmic}[1]
\FORALL{r in Requirements}
\FORALL{m in Methods}
\item OutputPredicted= TraceRefiner(r, m)
\IF {m.GoldStandard[r]==m.Trace[r]}
\IF {m.GoldStandard[r]==T}
\RETURN TP
\ELSIF {m.GoldStandard[r]==N}
\RETURN TN
\ENDIF
\ELSE
\IF {m.GoldStandard[r]==N \AND
OutputPredicted.Value==T}
\RETURN FP
\ELSIF {m.GoldStandard[r]==T \AND
OutputPredicted.Value==N}
\RETURN FN
\ELSE
\RETURN E
\ENDIF
\ENDIF
\ENDFOR
\ENDFOR
\end{algorithmic}
\label{alg:ValidationAlgo}
\end{algorithm}
\end{document}