Does anyone know of any packages that support this style of writing proofs?

A non-trivial example of "Structured Derivation" syntax, taken as a screenshot from Ralph-Johan Back's paper

The only things that I've found are: tex-ewd, a bunch of plain TeX macros on CTAN written specifically with Dijkstra in mind; and a Windows-only version of LyX that's been extended with support with structured derivations. (It's too bad that the LyX-SD is limited to Windows, because I'd guess that writing proofs in LyX would be wonderful)

In the case that there's nothing out there and that I have to roll my own, are there any packages that are similar enough that I could learn the "right way" to go about making a Structured Derivations package for LaTeX?

And I offer a pre-emptive "thank you" :) I'll be really grateful for any help.

If you need more information to be helpful (or even if I've just piqued your interest) here are some good resources:

  • You can put the additional links without the http pershaps as code by tabbing 4 spaces and one of us of the moderators will activate the links.
    – yannisl
    Mar 25, 2012 at 19:30
  • There's a continuation/follow-up here about implementation. Jun 16, 2012 at 17:44
  • Have you found the package you were searching for? If so, I'm interested in using it! Please let me know. Dec 24, 2014 at 15:46

3 Answers 3


I'd be tempted to use a sequence of itemize and enumerate environment, using the enumitem package to help with formatting

enter image description here

In the code below I've used the resume feature provided by the enumitem package to help keep the numbering of the enumerate environment without having to hardcode any of the numbers.

I've also used the optional argument of the \item command, which can be used, for example


If you plan to use this a lot though, you could always make this into a \newcommand


% global settings for enumerate environment

% itemize environment, when at nested depths 2, 3, 4

    \item Show that $f$ is continuous at $x_0$, when
            \item\label{item:range} $f(x)=\sqrt{x}$ when $x\geq 0$, and
            \item\label{item:pos} $x_0>0$
    \item[$\Vdash$] $f$ is continuous at $x_0$
    \item[$\equiv$] $\{\text{definition of continuity}\}$

            $(\forall\epsilon>0\cdot \exists\delta>0\cdot\forall x\geq 0\cdot |x-x_0|<\delta\Rightarrow|f(x)-f(x_0)|<\epsilon)$
    \item[$\equiv$] $\{\text{choose arbitrary }\epsilon \text{generilization rule}\}$
        \item Show that $(\exists\delta>0\cdot\forall x\geq 0\cdot |x-x_0|<\delta\Rightarrow |f(x)-f(x_0)|<\epsilon)$, when
            \item $\epsilon>0$
        \item[$\Vdash$] $\{\text{find a suitable value for } \delta\text{ witness rule}\}$
            \item Show that $\delta>0\wedge(\forall x\geq 0\cdot|x-x_0|<\delta\Rightarrow|f(x)-f(x_0)|<\epsilon)$, when
                \item $\delta=?$ $\sharp$ $\delta=\epsilon\cdot\sqrt{x_0}$
            \item[$\Vdash$] $\{\text{show the two conjuncts separately, use generalization rule for second conjunct}\}$
                \item Show that $|f(x)-f(x_0)|<\epsilon$, when
                    \item\label{item:xnonneg} $x\geq 0$, and
                    \item $|x-x_0|<\delta$
                \item[$\Vdash$] $|f(x)-f(x_0)|$
                \item[$=$] $\{$assumption \ref{item:range}, $f(x)$ and $f(x_0)$ are defined by assumptions \ref{item:xnonneg} and \ref{item:range}$\}$
                \item[] $|\sqrt{x}-\sqrt{x_0}|$
                \item[$=$] $\{$extend with conjugate value for $\sqrt{x}-\sqrt{x_0}$, i.e., with $\sqrt{x}+\sqrt{x_0}>0$$\}$
                \item[] $\dfrac{|x-x_0|}{\sqrt{x}+\sqrt{x_0}}$
                \item[$\leq$] $\{$make divisor smaller, $\sqrt{x}\geq 0$ $\}$
  • Is this a common use of \Vdash ("forces")?
    – Alan
    Feb 7, 2022 at 14:44

You may be interested in a package written by Leslie Lamport, pf2, which is used to produced a structured proof that looks pretty similar to the style used by Dijkstra. The package is just a single .sty file and does not seem to be hosted on CTAN, but you can find it here: http://lamport.azurewebsites.net/latex/latex.html.

The style provided by this package would look like one of these two columns below (you get the freedom to change the styles of the numbering and indentation). I think after some tweaking you may be able to achieve the desired aesthetic. Well, arguably easier than the heavy-lifting using a bunch of nested itemize and enumerate.

Structured proof in <code>pf2.sty</code>

Edit: After some googling I don't find an elegant way of creating nested lists with ease. Markdown + KaTeX (or MathJax) and LaTeX conversion thru pandoc may be close to that but you only get a limited set of LaTeX commands supported within the Markdown environment.


Fokkinga posted such a package in January 2015; it's called calculation.

It follows the approach of eqnarray somehow (so says the documentation). So fractions and big operators get cramped. Otherwise, it's nice.

  • The default output with calculation would have to be changed dramatically (it seems) in order to match that of the OP's post. Could you reproduce the OP's output with calculation?
    – Werner
    Mar 10, 2015 at 21:40
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Mar 10, 2015 at 21:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .