OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] How to include Mathematical equations in DocBook5 ?


Thank you Bob; that was helpful.

I have now included the flattened entity definition file from W3C.
I am trying to include the following equation( sqrt(a) ) in my document:

<equation>
      <mml:math>
          <mml:msqrt>
               <mml:mi>a</mml:mi>
          </mml:msqrt>
      </mml:math>
</equation>

However, the element msqrt is not rendered as a Squareroot symbol, instead it appears as # in the transformed PDF file. I know, the element msqrt is declared in the mathml.dtd. Do I need to include the mathml.dtd in my DB5 document(or the customdb.rng schema)? If so, how do I include the mathml.dtd?

I have the following in the customdb.rng:

<include href="/w/audi/anagha/work/SVN/documentation/oXygen/frameworks/docbook/5.0/rng/docbook.rng">
  
    <define name="db._any.mml">
      <externalRef href="mml2/mathml2.rng"/>
    </define>
    
    <define name="db._any">
      <element>
        <anyName>
          <except>
            <nsName ns="http://docbook.org/ns/docbook"/>
            <nsName ns="http://www.w3.org/1999/xhtml"/>
            <nsName ns="http://www.w3.org/1998/Math/MathML"/>
          </except>
        </anyName>
        <zeroOrMore>
          <choice>
            <attribute>
              <anyName/>
            </attribute>
            <text/>
            <ref name="db._any"/>
          </choice>
        </zeroOrMore>
      </element>
    </define>
  </include>

Please let me know.

TIA,
Anagha




Bob Stayton wrote:
Hi,
Any general entities like &sum; that you use in your document must be declared, either in the document or the schema.  Since RelaxNG does not have a way to declare entities, your document must reference the declarations of such entities.  See:
 
 
In addition to the DocBook entities, the MathML DTD also has many entities.  If you decide to use those, you will also have to include the declaration of those entities.
 
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
 
 
----- Original Message -----
Sent: Monday, March 17, 2008 10:51 AM
Subject: Re: [docbook-apps] How to include Mathematical equations in DocBook 5 ?

Oh! I was under the (wrong) impression that including the namespace declaration in the customdocbook.rng schema was sufficient. I now have the namsespace declaration in the xml document & now it does not complain about the prefix "mml"; however, now upon validation, I get the following error:
"The entity "sum" was referenced, but not declared."
at line:
<mml:mo>&sum;</mml:mo>

Am I missing something ?


Bob Stayton wrote:
Hi,
Well, any namespace you use in a document must be declared in the document.  If you are using DocBook5, you know how to declare the docbook namespace in the root element's start tag.  Do the same for the mml namespace in the same place and it will apply to the entire document.  That should eliminate that error. 
 
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
 
 
----- Original Message -----
Sent: Friday, March 14, 2008 3:15 PM
Subject: Re: [docbook-apps] How to include Mathematical equations in DocBook 5 ?

Thank you for your reply.

Following the instructions on http://docbook.org/docs/howto/#faq-customization-mathml, I downloaded the MathML RELAX NG schema from http://yupotan.sppd.ne.jp/relax-ng/mml2.html & unpacked it in "mathml" directory. Added the following lines to my customdocbook.rng
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<include href="/path/to/docbook.rng">
  <define name="db._any.mml">
    <externalRef href="mathml/mathml2.rng"/>
  </define>

  <define name="db._any">
    <element>
      <anyName>
        <except>
          <nsName ns="http://docbook.org/ns/docbook"/>
          <nsName ns="http://www.w3.org/1999/xhtml"/>
          <nsName ns="http://www.w3.org/1998/Math/MathML"/>
        </except>
      </anyName>
      <zeroOrMore>
        <choice>
          <attribute>
            <anyName/>
          </attribute>
          <text/>
          <ref name="db._any"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
</include>
</grammar>

Then, I added the following equation:
<sect1><title>Equations <title>
<equation>
            <title>My MathML example</title>
            <mml:math>
                <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>
</sect1>

in the article.  When I tried to validate it, (I'm using oXygen XML Editor) I got error messages:

conflicting ID-types for attribute "linkend" of element "msginfo" from namespace "http://docbook.org/ns/docbook"
The prefix "mml" for element "mml:math" is not bound.

I read the information on: http://www.sagehill.net/docbookxsl/ProcesingDb5.html#Db5Validation
However, did not find it helpful, may be because I'm using the XML editor.

Any idea, why does it not like/recognize the prefix "mml"?

Thanks!


Bob Stayton wrote:
Hi,
In DocBook 5's RelaxNG schema, the imagedata, equation, and informalequation elements can contain elements in the MathML namespace.  So the equation example in the book is still accurate, you can just skip the DOCTYPE declarations.

Once you mix namespaces, though, validation becomes more complicated.  See this doc for more information:

http://www.sagehill.net/docbookxsl/ProcesingDb5.html#Db5Validation

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- From: "Anagha Tongaonkar" <anagha@3dgeo.com>
To: "Bob Stayton" <bobs@sagehill.net>; "DocBook Apps" <docbook-apps@lists.oasis-open.org>
Sent: Tuesday, March 11, 2008 12:07 PM
Subject: [docbook-apps] How to include Mathematical equations in DocBook 5 ?


Hi All,

I would like to know how to include Mathematical equations in DocBook 5 ?
I know of an example listed on: http://www.sagehill.net/docbookxsl/MathML.html
However, it's using DB 4.5. I am using DB 5.0.

Any examples will be helpful.

TIA,
Anagha





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]