Skip to main content

Section 15.1 Theorem-Like Elements

The tags <theorem>, <algorithm>, <claim>, <corollary>, <fact>, <identity>, <lemma>, and <proposition> have the same structure in PreTeXt, so we will just illustrate <theorem> here.
Listing 15.1.1. A theorem
<!--********************************************************************
Copyright (C) 2019-2026  Robert A. Beezer

This file is part of PreTeXt.

PreTeXt is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 or version 3 of the
License (at your option).

PreTeXt is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PreTeXt.  If not, see <http://www.gnu.org/licenses/>.
*****************************************************************-->

<theorem>
    <title>Optional</title>
    <creator>I. Newton</creator>
    <origins><xref ref="knuth-literate-programming"/></origins>
  <statement>
    <p>
      Here's the statement of the theorem.
    </p>
  </statement>

  <proof>
    <p>
      You don't actually need a proof,
      but put it inside the <c>theorem</c>.
      You can actually put another <c>proof</c> right after this one if you want to.
    </p>
  </proof>
</theorem>
The code in Listing 15.1.1 produces the following output:

Proof.

You don’t actually need a proof, but put it inside the theorem. You can actually put another proof right after this one if you want to.
The <title> is optional and typically used for theorems with names. To give an attribution, one can use the optional <creator> tag. To cite where a result comes from, use the optional <origins> tag, which holds one or more <xref> (typically to bibliography entries) and nothing else. Every conversion renders the title first, then the creator and the origins together in parentheses, so supply no punctuation of your own. Cross references (see Section 22.1) can be made using the name or the number, depending on how the author codes them.
A theorem-like element can contain multiple <proof> elements. In such instances, it would be useful to use the <title> tag within your proof. By default, a <proof> is hidden in a knowl when using HTML output. Click the “Proof.” heading to expand the proof. Click it again to hide the proof. A <proof> can also be divided into <case>s, each of which can have a title. Although it has not always been so, you can author a <proof> all on its own within a division. The structure of such a detached <proof> is the same as for a <proof> contained within a theorem-like element.
You can use <definition> essentially like <theorem>, but a <definition> does not have a proof. It may carry a <creator> and an <origins> just as a theorem does. You are encouraged to use the <term> tag to set off the word being defined. If you wish to include a list of notation as an appendix as your document, you might also add a <notation> tag such as shown in Listing 15.1.3. A <notation> tag has no effect unless you have an <appendix> with a <notation-list/> in it.
Listing 15.1.3. A definition with notation
<!--********************************************************************
Copyright (C) 2019-2026  Robert A. Beezer

This file is part of PreTeXt.

PreTeXt is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 or version 3 of the
License (at your option).

PreTeXt is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PreTeXt.  If not, see <http://www.gnu.org/licenses/>.
*****************************************************************-->

<definition>

  <notation>
    <usage><m>\binom{n}{k}</m></usage>
    <description>binomial coefficient</description>
  </notation>

  <statement>
    <p>
      The <term>binomial coefficient</term>
      <m>\binom{n}{k}</m> is the number of <m>k</m>-element subsets of an <m>n</m>-element set.
    </p>
  </statement>
</definition>
The code in Listing 15.1.3 produces the following output:

Definition 15.1.4.

The binomial coefficient \(\binom{n}{k}\) is the number of \(k\)-element subsets of an \(n\)-element set.