FAQ

How do I define LaTeX theorems?

By default, this packages defines LaTeX theorems for you. Sometimes, this is not what you want. To disable this, you have to:

  • set proof_latex_notheorem to the list of theorem types you want to define yourself (e.g. proof_latex_notheorem = ["definition", "theorem", "proof"]);

  • define those theorems (or environment) in latex_elements['preamble']. For instance:

latex_elements = {
    # Additional stuff for the LaTeX preamble.
    'preamble': r"""
       % My custom definition of environments definition, theorem, proof.
    """,
}
proof_latex_notheorem = ["definition", "theorem", "proof"]

LaTeX adds numbers to my proofs. How do I remove them?

Using the default configuration, LaTeX will number proofs (e.g. Definition 1, Theorem 2, Proof 3), which is probably not what you want.

To disable proof numbering with LaTeX, you have to :

  • Add "proof" to proof_latex_notheorem. Sphinx will define a proof::proof directive, but LaTeX will not define a proof environment.

  • This proof environment has to be defined in latex_elements['preamble'], either with your custom command, or by importing package amsthm, which defines such a proof environment (which is not numbered).

The conf.py contains:

latex_elements = {
    # Additional stuff for the LaTeX preamble.
    'preamble': r"""
        \usepackage{amsthm}
    """,
}
proof_latex_notheorem = ["proof"]

How to have different counters for definitions, theorems, etc.?

HTML

You can’t.

LaTeX

If option proof_latex_main is set to None, definitions, theorems, properties, etc. will have different counters.

For more complex configuration (e.g. theorems and properties share a counter, but definitions do not), you have to define theorems yourself (see How do I define LaTeX theorems?).

How to number theorems?

HTML

By default, theorems are not numbered. To number them, set numfig = True in the configuration file (see HTML numbering to see advanced options).

LaTeX

By default, theorems are numbered. Nothing to configure here.

How not to number theorems?

In both cases, theorems cannot be referenced using :numref:, but with :ref:.

HTML

Easy: in the configuration, use numfig = False (or do not define numfig, which is False by default).

LaTeX

To disable theorem numbering, you have to define theorems yourself. That is:

  • tell sphinx not to define theorem environments:

    proof_latex_notheorem = ["algorithm", "conjecture", "corollary", "definition", "example", "lemma", "observation", "proof", "property", "theorem"]
    
  • define theorems in LaTeX, using the starred command (provided by amsthm or ntheorem):

    latex_elements = {
        # Additional stuff for the LaTeX preamble.
        "preamble": r"""
           \usepackage{amsthm}
    
           \newtheorem*{definition}{Definition}
           \newtheorem*{theorem}{Theorem}
        """,
     }
    

How to customize LaTeX numbering?

LaTeX is great at counting stuff, and Sphinx do not intervene in this. To customize theorem numbering in LaTeX, you can:

Do you want some irrelevant theorems?

Here is an irrelevent theorem (source) to show that theorems can be referenced from the same page (Theorem 3) or from other pages (Theorem 1).

Theorem 3
  1. If \(\Lambda\) is a canonical modal logic, then the class of all frames that validate \(\Lambda\) is quasimodal.

  2. A class of frames closed under the three fundamental frame constructions and ultraproducts is quasimodal.

  3. A modally definable elementary class of frames is quasimodal.

And here are others, without any label, or without title.

Theorem 4

Let \(\Lambda\) be the modal logic of the quasimodal class K of frames, and let L be a class of frames containing K and having the same modal logic \(\Lambda\).

  1. K and L have the same hybrid logic.

  2. L is quasimodal

Corollary 5 (Non-quasimodal class of frames)

Let K be a class of frames, and \(\varphi\) a hybrid formula valid in K. If \(\varphi\) is not valid in the closure of K under the three fundamental operations and ultraroots, then K is not quasimodal.

Conjecture 6 (Fake \(\Gamma^*\) conjecture)

This is a dummy conjecture to illustrate that one can use math in theorem titles.

Note that math typesetting is lost when referencing the theorem: Fake \Gamma^* conjecture.