实际很简单,你只需要new一个float就好了,这样定理都放在一个float里你的需求都满足了。
粗略一个示例
\documentclass{article}
\usepackage{amsthm}
\newtheorem{thm}{Theorem}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{newfloat}
\DeclareFloatingEnvironment{fthem}
\newenvironment{fthm}{%
\begin{fthem}\begin{thm}
}
{\end{thm}\end{fthem}}
\begin{document}
\lipsum[1-4]
\begin{fthm}[$insts_P^{abs}(expr, ctx), relevant(a_{var}, \omega)$] $\ $\\\label{alg:cell:inst}
\begin{verbatim}
let $insts_P^{abs}$ expr ctx =
let $a_{var}$ = new_variable () in (* We need $a_{var}$ to be unused in expr and ctx*)
let R = relevant $a_{var}$ ($a_{var} = expr \wedge \neg ctx$) in
ler R' = filter (fun e -> e $\ne \top$) R in (*We remove $\top$*)
if R = [] then [(($\bot$, expr[$\bot$]), ())] (*We need $R$ non-empty*)
else map (fun e -> ((e, expr[e]), ())) R
Blabla
\end{verbatim}
Some result about this function
\bigskip
\begin{verbatim}
let relevant $a_{var}$ $\omega$ =
(*We add two parameters that we set in first position
to keep track of full context and visited variables*)
relevant_impl $\omega$ [] $a_{var}$ $\omega$
Blabla
\end{verbatim}
Some result about this function
\end{fthm}
\lipsum[1-3]
\end{document}
但是float有点太“浮动”了。比如在这个例子里CH3和CH4就没必要分页。
以下是代码。