算法子状态

算法子状态

我正在尝试将我的一个算法的描述转换为 TeX。我的算法将通过文字而不是代码来描述。

我的第一个问题是我更喜欢 1. 符号而不是 1:

我通过 解决了这个问题\algsetup{linenodelimiter={.}}

然后我想摆脱算法的编号,所以我使用:

\renewcommand{\thealgorithm}{}

现在我的 MWE 代码是:

\documentclass[12pt,a4paper,twoside]{report} 
\usepackage[ngerman]{babel}
\usepackage[Algorithmus]{algorithm}
\usepackage[noend]{algorithmic}
\renewcommand{\thealgorithm}{}
\algsetup{linenodelimiter={.}}
\begin{document}
\begin{algorithm}
\caption{MyAlgName}
\begin{algorithmic}[1]
  \STATE First Step of the Alg
  \STATE Second Step of the Alg
  \STATE Substate a. First Part of Second Step
  \STATE Substate b. Second Part of Second Step
  \STATE Third Step of the Alg
\end{algorithmic}
\end{algorithm}
\end{document} 

并产生在此处输入图片描述

但我想将第三和第四个状态改为类似子状态的东西。我更喜欢编号为 a. 和 b. 并略微缩进。

最后它看起来应该是这样的:

  1. 算法的第一步

  2. 算法的第二步

    a. 子状态的第一部分

    b. 子状态的第二部分

  3. 算法的第三步

此外,我还考虑过更改各州的编号大小。是否可以更改编号的大小以匹配实际文本(在算法环境中,编号似乎要小一些,可能是为了用编号来计算代码行数)

我非常感谢您的帮助,并提前致谢。

相关内容