下面是一个虚拟算法代码。使用此代码我没有得到所需的输出。代码如下:
\documentclass{article} \usepackage[ruled, lined, linesnumbered, commentsnumbered, longend]{algorithm2e} \usepackage{xcolor} \begin{document} \newcommand\mycommfont[1]{\small\ttfamily\textcolor{blue}{#1}} \SetCommentSty{mycommfont} \begin{algorithm} \SetKwFunction{isOddNumber}{isOddNumber} % \SetKwInput{Input}{Input} % \SetKwInput{Output}{Output} \SetKwInOut{KwIn}{Input} \SetKwInOut{KwOut}{Output} \KwIn{A list where each element is an integer.} \KwOut{Processed list.} First List is follows \begin{itemize} \item One \item Two \item Three \end{itemize} Second List is follows \begin{itemize} \item Four \item Five \item Six \end{itemize} \caption{A plain algorithm} \end{algorithm} \end{document}
我想要的输出为:
1. First List is as follows
i. One
ii. Two
iii. Three
2. Second List is as follows
i. Four
ii. Five
iii. Six
上述 latex 代码无法保留其编号顺序,即 2. 未打印在输出中。此外,项目符号采用点格式,而我想要字母格式,并且每个子编号之间都有空格,而我不需要,因为我的实际算法相当长。
答案1
也许你想要这样的东西 -
\documentclass{article}
\makeatletter
\let\@alph\@roman
\makeatother
\begin{document}
\begin{enumerate}
\item First List as follows
\begin{enumerate}
\item One
\item Two
\item Three
\end{enumerate}
\item Second List is follows
\begin{enumerate}
\item Four
\item Five
\item Six
\end{enumerate}
\end{enumerate}
\end{document}