Using MathML for formulas in docbook

Johnny Jazeix jazeix at gmail.com
Mon Jun 20 09:40:40 BST 2022


Le mar. 14 juin 2022 à 22:40, Albert Astals Cid <aacid at kde.org> a écrit :

> El dimarts, 14 de juny de 2022, a les 21:49:04 (CEST), Johnny Jazeix va
> escriure:
> > Hi,
> >
> > After discussing with a French contributor translating KStars, we noticed
> > that some formulas were stored as images where we can potentially use
> > MathML formulas to display them.
> >
> > There is the <equation> tag that do not require MathML but some of the
> > formulas use fractions (
> > https://invent.kde.org/education/kstars/-/blob/master/doc/lambda_ex.png
> for
> > example) and I didn't find how to display them the same without MathML.
> >
> > Is there any existing docbook that uses MathML? If I understand
> correctly,
> > the way to tell we use MathML is using a specific doctype (
> > http://www.sagehill.net/docbookxsl/MathML.html) but as we already
> > customized one for KDE, it may not be easy to do it.
>
> Using it's specific docttype it's just for the files that are exclusively
> mathml and they are supposed to be included from other docbook files, no?
>
> That should be fine as far as i understand, see for example stuff like
> kstars/doc/faq.docbook it doesn't even have a doctype because it's just
> included from the "main" file.
>
> My bigger concern is that this is an extra compile-time dependency so we
> need to find a way to express that in CMakeLists.txt so people don't start
> getting some strange compile time errors when compiling the docbbok (and we
> probably need to include that in the CI images).
>
> My current suggestion, give it a quick try to see if it works :D
>
>
Hi,

Thanks for the pointer.

we did a quick try and it does not work and for now, it's not much worth
the time :).
Just in case someone stumbles on it and wants to dig deeper:
including directly http://www.w3.org/Math/DTD/mathml2/mathml2.dtd cause an
issue: I/O error : Attempt to load network entity
http://www.w3.org/Math/DTD/mathml2/mathml2.dtd

So I installed the corresponding package (w3c-mathml2 in archlinux).

I added the corresponding entities in index.docbook:
<!ENTITY % MATHML.prefixed "INCLUDE">
<!ENTITY % MATHML.prefix "mml">
<!ENTITY % equation.content "(alt?, (graphic+|mediaobject+|mml:math))">
<!ENTITY % inlineequation.content
                "(alt?, (inlinegraphic+|inlinemediaobject+|mml:math))">
<!ENTITY % mathml PUBLIC "-//W3C//DTD MathML 2.0//EN"
        "/usr/share/xml/w3c/mathml2/mathml2.dtd"> -> <!-- hardcoded path!
-->
%mathml;

But then, I have the issue reported in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=993638 ("error :
xmlAddEntity: invalid redeclaration of predefined entity") which refers to
this bug: https://gitlab.gnome.org/GNOME/libxml2/-/issues/308.) and I
stopped here.

Cheers,

Johnny


> Cheers,
>   Albert
>
> >
> > Cheers,
> >
> > Johnny
> >
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-i18n-doc/attachments/20220620/c7512e52/attachment.htm>


More information about the kde-i18n-doc mailing list