### Theorem Environment

Michael Bächtold asked me whether it was possible to use something like AMS LaTeX’s theorem-environments in Instiki. Instiki doesn’t have a macro facility (for defining new environments). But if one were clever, and used Class Names to identify theorem-environments, defining new ones would, at worse, require tinkering with the CSS Stylesheet.

I put out a new version, today, which does just that. For the details, see the manual.

Here’s a sample of code (LaTeX original):

`+-- {: .un_defn} ###### Definition Let $H$ be a subgroup of a group $G$. A *left coset* of $H$ in $G$ is a subset of $G$ that is of the form $x H$, where $x \in G$ and $x H = \{ x h : h \in H \}$.`

Similarly a *right coset* of $H$ in $G$ is a subset of $G$ that is of the form $H x$, where $H x = \{ h x : h \in H\}$. =--

+-- {: .num_lemma #LeftCosetsDisjoint} ###### Lemma Let $H$ be a subgroup of a group $G$, and let $x$ and $y$ be elements of $G$. Suppose that $x H \cap y H$ is non-empty. Then $x H = y H$. =--

+-- {: .proof} ###### Proof Let $z$ be some element of $x H \cap y H$. Then $z = x a$ for some $a \in H$, and $z = y b$ for some $b \in H$. If $h$ is any element of $H$ then $a h \in H$ and $a^{-1}h \in H$, since $H$ is a subgroup of $G$. But $z h = x(a h)$ and $xh = z(a^{-1}h)$ for all $h \in H$. Therefore $z H \subset x H$ and $x H \subset z H$, and thus $x H = z H$. Similarly $y H = z H$, and thus $x H = y H$, as required. =--

+-- {: .num_lemma #SizeOfLeftCoset} ###### Lemma Let $H$ be a finite subgroup of a group $G$. Then each left coset of $H$ in $G$ has the same number of elements as $H$. =--

+-- {: .num_theorem #Lagrange} ###### Theorem **(Lagrange's Theorem)**. Let $G$ be a finite group, and let $H$ be a subgroup of $G$. Then the order of $H$ divides the order of $G$. =--

You can see the XHTML output here. The LaTeX output is amsthm-compatible, and cross-referencing works as in LaTeX:

`See Lemma \ref{LeftCosetsDisjoint}.`

produces a hyperlink to the named Lemma.

#### Implementation

Producing auto-numbered theorems is easy with CSS generated-counters. The upside is that new theorem-like environments, each with their own counter, are trivial to define (*without* monkeying with the application source code). The downside is that the CSS-generated equation numbers are not guaranteed to agree (but usually will) with the ones produced by the application’s reference-to-id resolution. I.e, when I say “`Theorem \ref{Lagrange},`

” the link-text of the generated hyperlink is usually, but occasionally might not be, “correct.”

I suppose, if this theoretical problem actually crops up in practice, I could fix that in a future version.

The other annoyance was that `display:run-in`

isn’t implemented in Gecko, which meant that the obvious markup isn’t the one that eventually ends up in the DOM.

#### Zotero

For a while now, I have been toying with the idea of integrating some bibliography-management facilities into Instiki. It seems, though, that rather than starting from scratch, it might be more sensible to try to integrate with Zotero. Roughly, I’d want to use Zotero to assemble a library of bibliographic data, and then make that data available to Instiki, using the Zotero Data API.

Unfortunately, Zotero’s support for SPIRES and the arXiv is rather sucky. They both offer much more bibliographic metadata than the corresponding Zotero plugins currently make use of. So, before I even get started, I’m tempted to go off and rewrite those plugins…