Thm Environment

Features

You may have see that my course are online, no pdf files but directly as webpages. I explain here how to achieve a similar result, using hugo and the Academic theme.

The Academic theme provides a nice layout (=design) for documentation. The math expression can be written mostly as in a basic $\LaTeX$ file thanks to MathJax (just set math = true in the frontmatter of your .md file). Some features were however missing for a math course, especially the “AMS Theorem environment” of $\LaTeX$.

I have developped a package, academic-tools, which contains Hugo shortcodes to mimic amsthm $\LaTeX$ Package. A shortcode is a portion of code that Hugo will escape from the Markdown, making it possible to call external functions inside the Markdown. It features

  • Customizable design
  • Different type: Theorem, Proposition, Lemma, Corollary, Definition
  • Theorem naming
  • Cross reference
  • Multi languages
  • Proof environment
  • Auto numbering (using CSS)

Example

Thm blocks

{{< thm/thm type="theorem" name="of me" label="thm:me">}}
This theorem proves that covfefe.
{{< /thm/thm >}}
{{< thm/proof >}}
The proof is very good. I like proof. I have big proof.
{{< /thm/proof >}}

leads to this

Théorème 1 (of me).

This theorem proves that covfefe.

Proof.

The proof is very good. I like proof. I have big proof.

You can change type="theorem" by proposition, lemma, corollary or definition.

Cross reference

A “theorem” can moreover be referenced using thm/ref using three different ways:

  1. Inline implicite (order of arguments matters) :
Personally, my favorite is the {{< thm/ref "thm:me" "covfefe Theorem" />}}.

Personally, my favorite is the covfefe Theorem. 2. Inline explicite (order of arguments does not matter!):

Personally, my favorite is the {{< thm/ref ref="thm:me" text="covfefe Theorem" />}}.

Personally, my favorite is the covfefe Theorem. 3. Environment:

Personally, my favorite is the {{< thm/ref "thm:me">}}covfefe Theorem{{< /thm/ref >}}.

Personally, my favorite is the covfefe Theorem.

As you notice and contrary to $\LaTeX$, the cross reference do not provide the number of the theorem. This is a little bit complicated as the numbering is done through CSS counter and I believe it is not necessary. However, if you are interested in, we can discuss about it.

Installation

Please refer to the README file of the repository.

Précédent