答案1
完成缺少代码($
,\begin{document}
和\end{document}
)的代码片段后,您的代码片段将按预期工作:
\documentclass[preview]{standalone}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
% \usepackage{algpseudocode} % not needed in this example
\begin{document} % <--- added
\begin{algorithm}[H]
\eIf{$\Phi$}{\KwRet{a}}{\KwRet{b}} % <--- added $
\caption{???} % <--- added (but not needed)
\end{algorithm}
\end{document} % <--- added