Showing posts with label jeuclid. Show all posts
Showing posts with label jeuclid. Show all posts

Monday, January 25, 2010

Rendering of MathML with fop

I was having issues with rendering of MathML equation within fop. The actual problem can be reproduce using only jeuclid package. So clearly the problem is at that level.

See for instance the bug report:
* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=566801

Here is what it looks like on my machine:



Compared to:



Ref:
* http://jeuclid.sourceforge.net/example1.html

Sunday, January 24, 2010

Generating PDF from docbook on Linux (OSS)

My goal was to generate a PDF file from an input docbook file. Sound easy ? Well here are the minimal steps on a lenny/stable system:



$ sudo apt-get install docbook-xsl


and

$ sudo apt-get install -t testing fop libjeuclid-fop-java

You absolutely need fop from testing.

Then to get hyphen working you need to follow instructions from:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=526092#20

I used the root solution:

$ cat /etc/fop.conf
FOP_HYPHENATION_PATH=/usr/local/share/java/fop-hyph.jar

and

$ cat ~/.foprc
find_jars jeuclid-core jeuclid-fop

You really need fop from testing otherwise find_jars will not work !

Then I tried on a very simple MathML/docbook example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
[
<!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"
       "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
%mathml;
]
>
<article>
 <sect1 id="section_Description">
   <title>Description</title>
     <para>
<equation>
<title>My MathML example</title>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
 <mml:mrow>
   <mml:mo>&sum;</mml:mo>
   <mml:mn>4</mml:mn>
   <mml:mo>+</mml:mo>
   <mml:mi>x</mml:mi>
 </mml:mrow>
</mml:math>
</equation>
     </para>
 </sect1>
</article>

Then execute this way:

$ fop -xsl /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl -xml math.xml -pdf math.pdf

Here is what it looks like:






Ref:
  • http://jeuclid.sourceforge.net/jeuclid-fop/index.html
  • https://bugzilla.redhat.com/show_bug.cgi?id=479685
  • http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=440518#42