LaTeX for Numbered Figures

Last modified by Michael Hamann on 2024/03/12 12:09

cogProvides the User Interface Extensions Points to integrate Numbered Figures with the Latex Extension
Developed by

Manuel Leduc, Michael Hamann

0 Votes
LicenseGNU Lesser General Public License 2.1


Installable with the Extension Manager


This extension is only needed if you wish to use Numbered Figures Application in combination with LaTeX.

It allows to take into account the counters configuration during LaTeX export.


  • A block type graph is configured
  • Two inline types theorem and lemma are configured
  • A counter math containing theorem and lemma is configured
  • Numbered Figures are activated on the page
{{figure type="graph"}}

Polynomial of degree three

{{figure type="theorem"}}
Pythagorean theorem

Let ##f## be a function whose derivative exists in every point, then ##f## is  a continuous function.

{{figure type="lemma"}}
Given two line segments whose lengths are ##a## and ##b## respectively there is a real number ##r## such that ##b=ra##.

XWiki Page result


LaTeX Export result


Export Technical Details

Everything documented in LaTeX for the Figure Macro holds, but two things are adapted to take into account counters configuration.

Block Figure Export

When figures of style block share a counter, the prelude is adapted. The first type of the counter will be declared as a floating environment, and the following types are skipped.
Then, during the FigureBlock generation, all the types of the same counter will use the identifier of the first type as their environment so that they share the same counter.
But, all the FigureCaptionBlock elements contained in a given FigureBlock are overridden with the caption label corresponding to their actual type.
Therefore, the counter is shared between the figure types, but their label matched their actual type.
For instance, assuming graph and plot shares the same counter, the following latex will be produced for a document containing two figures respectivelly of :

% Prelude:
% No floating environment for 'plot'.

% Graph content...


\caption[Graph caption]{Graph caption} % Graph 1: Graph caption

\begin{graph}[h] % Figure of type plot using the graph environment as it is the first figure type of its counter
% Plot content...

\captionsetup{name=Plot} % Overridden caption label

\caption[Plot caption]{Plot caption} % Plot 2: Graph caption (the counter is incremented here)

Inline Figure Export

When figures of style inline share a counter, the prelude is adapted. The first figure type of the counter will be declared as usual, and all the following figure types of the same counter will have an additional parameters reference the first figure type.
In the case of the example above, the prelude is:

\newtheorem{theorem}[lemma]{Theorem} % The second type 'theorem' references the first type 'lemma' so that they share a counter

The rest of the generation stays unchanged.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.


Dependencies for this extension (org.xwiki.contrib.numbered.content:application-numbered-content-figures-latex 1.10.1):

Get Connected