![理论 CS 风格数学步骤](https://linux22.com/image/381600/%E7%90%86%E8%AE%BA%20CS%20%E9%A3%8E%E6%A0%BC%E6%95%B0%E5%AD%A6%E6%AD%A5%E9%AA%A4.png)
答案1
您可以使用calculation
(只要您修复了几个问题)或定义您自己的环境。
\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage{stmaryrd}
\usepackage{calculation}
\usepackage{showframe}
% generic command
\newcommand{\catam}[1]{\llparenthesis#1\rrparenthesis}
% for csproof
\newenvironment{csproof}
{\begin{equation*}\begin{aligned}}
{\end{aligned}\end{equation*}}
\newcommand{\pline}[1]{\\}
\newcommand{\eline}[1]{{=}\quad&\quad\{\text{#1}\}\\}
% for calculation
\renewcommand{\Hsep}{0pt}
\makeatletter % fix the error of the package
\AtBeginDocument{\calc@indent\mathindent}
\makeatother
\begin{document}
This equation can be verified as follows:
\begin{csproof}
\pline{\langle\catam{h},\catam{k}\rangle\cdot\alpha}
\eline{split fusion}
\pline{\langle\catam{h}\cdot\alpha,\catam{k}\cdot\alpha\rangle}
\eline{catamorphisms}
\pline{\langle h\cdot\mathsf{F}\catam{h},k\cdot\mathsf{F}\catam{k}\rangle}
\eline{split cancellation (backwards)}
\pline{\langle
h\cdot\mathsf{F}(\mathit{outl}\cdot\langle\catam{h},\catam{k}\rangle,
k\cdot\mathsf{F}(\mathit{outr}\cdot\langle\catam{h},\catam{k}\rangle
\rangle}
\eline{$\mathsf{F}$ functor}
\pline{\langle
h\cdot\mathsf{F}\mathit{outl}\cdot\mathsf{F}\langle\catam{h},\catam{k}\rangle,
k\cdot\mathsf{F}\mathit{outr}\cdot\mathsf{F}\langle\catam{h},\catam{k}\rangle
\rangle}
\eline{split fusion (backwards)}
\pline{\langle h\cdot\mathsf{F}\mathit{outl},k\cdot\mathsf{F}\mathit{outr}\rangle
\cdot\langle\catam{h},\catam{k}\rangle}
\end{csproof}
This equation can be verified as follows:
\begin{calculation}
\langle\catam{h},\catam{k}\rangle\cdot\alpha
\step{split fusion}
\langle\catam{h}\cdot\alpha,\catam{k}\cdot\alpha\rangle
\step{catamorphisms}
\langle h\cdot\mathsf{F}\catam{h},k\cdot\mathsf{F}\catam{k}\rangle
\step{split cancellation (backwards)}
\langle
h\cdot\mathsf{F}(\mathit{outl}\cdot\langle\catam{h},\catam{k}\rangle,
k\cdot\mathsf{F}(\mathit{outr}\cdot\langle\catam{h},\catam{k}\rangle
\rangle
\step{$\mathsf{F}$ functor}
\langle
h\cdot\mathsf{F}\mathit{outl}\cdot\mathsf{F}\langle\catam{h},\catam{k}\rangle,
k\cdot\mathsf{F}\mathit{outr}\cdot\mathsf{F}\langle\catam{h},\catam{k}\rangle
\rangle
\step{split fusion (backwards)}
\langle
h\cdot\mathsf{F}\mathit{outl},k\cdot\mathsf{F}\mathit{outr}\rangle
\cdot\langle\catam{h},\catam{k}
\rangle
\end{calculation}
\end{document}
的错误calculation
在于\mathindent
在 之前设置\begin{document}
,而 则amsmath
在该点设置它。代码有必要的修复,以使calculation
环境尊重fleqn
数学缩进。
该showframe
包仅用于在文本块周围添加框架。
答案2
这显然是 Wim Feijen 的风格。它被实现在计算包作为calculation
环境。