Hi devs,
Manuel (doing all the work) and I (helping on the design) are working on the the following need:
- Be able to provide numbering for content other than figures, tables and headings
- Example of such content: Theorems, Lemmas, Definitions, etc
- Have the LaTeX export support it and map it nicely to LaTeX syntax
We’ve already progressed a lot but wanted to provide visibility about what we’re doing, share that knowledge and also make sure we’re going in the right direction.
So here’s how we’re implementing this need:
- Reuse the
{{figure}}
macro (now moved to a contrib project) to define all the types of content that can be numbered. - Extend the existing
type
parameter to support custom types that the user can define through configuration. Example usage:{{figure type="theorem"}}...
- When the Numbered Content Extension is installed, number all the figure types (i.e. prefix the caption with the figure type + counter value, e.g.
Theorem 1 ...caption content here...
) - Be able to share counters between figure types. For example you may want to share the same counter between theorems and lemmas. The counter used by a figure type is defined in the type configuration.
- Be able to support 2 layout styles:
inline
andblock
.-
inline
rendering (a style that would fit theorems, lemmas, etc - See Theorems and proofs - Overleaf, Online LaTeX Editor for some examples):(caption here) (figure content here)
-
block
rendering (the current style used for figures and tables - see Figures, Subfigures and Tables - Overleaf, Online LaTeX Editor for an example):(figure content here) (caption here)
-
- The figure style to use for a given figure type is also defined in the configuration.
- Notes:
- When the figure style is
inline
and a caption is defined, the rendering will be the following when Numbered Content is activated (based on a figure type oftheorem
):Theorem 1 (Pythagoras Theorem) ... content here...
- Currently, the Numbered Content extension adds the
figure type)(counter):
prefix to the caption but we’ve realized that this is not going to work well for all languages (for French for ex, this is wrong as it should befigure type)(counter) :
- notice the extra space). So we’re replacing the:
with something else. We’ve not fully decided yet but it could be displaying the caption in bold, using a dot (as it’s often done in LaTeX) or using some other style like putting the caption into some box with some different background color. Ideally this could be configurable but FTM we’re going to provide only a single style (which will be overridable by the user with some SSX). - Manuel is still trying to figure out (pun intended ;)) if we can reconcile the CKEditor editing of an
inline
figure style with the fact that at the xwiki syntax/XDOM level, the{{figureCaption}}
macro is standalone (and it should remain like since when exporting to HTML it’s generating a<figure>
and<figcaption>
elements which are block elements. Manuel thinks it could be done with some special CSS applied when editing with CK.
- When the figure style is
Let us know if you’re ok with this and/or if you see some problems with it.
Thanks