Dear list,
I am trying to convert LaTeX subfigures into DocBook, but I cannot find a
way to do so. What I currently have is something like this:
\begin{figure}
\centering
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{A}
\caption{Caption A}
\end{subfigure}
~
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{B}
\caption{Caption B}
\end{subfigure}
\caption{Pictures}
\end{figure}
The result looks like this:
A B
Fig. 1.1: Caption A Fig. 1.2: Caption B
Fig 1: Pictures
How can I encode something like this in proper DocBook? The only reference
I could find is
https://stackoverflow.com/questions/9177130/docbook-more-images-in-one-figure/39990292#39990292,
but that really looks like bad DocBook in my opinion… Functionality-wise, I
also have concerns about the way to make reference to a subfigure. Indeed,
when putting xml:id at the mediaobject level, I cannot use xref in order to
point to them:
Don't know what gentext to create for xref to: "mediaobject"
My DocBook example:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.1/rng/docbook.rng" schematypens="
http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.1/sch/docbook.sch"
type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<article xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.1">
<title>AE</title>
<para>Ref: <xref linkend="fig"/>; <xref linkend="a"/>; <xref
linkend="b"/></para>
<figure xml:id="fig">
<title>Main figure</title>
<mediaobject xml:id="a">
<textobject><simpara>A</simpara></textobject>
</mediaobject>
<mediaobject xml:id="b">
<textobject><simpara>B</simpara></textobject>
</mediaobject>
</figure>
</article>
My most natural solution would be to allow figure within figure, i.e.
things like this:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.1/rng/docbook.rng" schematypens="
http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.1/sch/docbook.sch"
type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<article xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.1">
<title>AE</title>
<para>Ref: <xref linkend="fig"/>; <xref linkend="a"/>; <xref
linkend="b"/></para>
<figure xml:id="fig">
<title>Main figure</title>
<figure>
<title>A</title>
<mediaobject xml:id="a">
<textobject><simpara>figure</simpara></textobject>
</mediaobject>
</figure>
<figure>
<title>B</title>
<mediaobject xml:id="b">
<textobject><simpara>figure</simpara></textobject>
</mediaobject>
</figure>
</figure>
</article>
Do you have a better way of encoding subfigures (with cross-referencing) or
is it completely out of scope for current DocBook (in which case I can
submit a PR for DocBook 5.2)?
Thank you in advance!
Thibaut Cuvelier