2

I am converting LaTeX to docbook with the following command

htlatex filename "xhtml,docbook-mml" " -cunihtf" "-cdocbk"

Now, unfortunately, the \cdot operator gets lost during translation. (It simply disappears.)

How can I define an XML sequence that should be emitted for every \cdot in the source file?

JohnB
  • 537

1 Answers1

5

If you compile just with

 htlatex filename "xhtml,docbook-mml"

you'll get this mathml:

<inlineequation  
role="inline" ><!--l. 7--><math 
xmlns="http://www.w3.org/1998/Math/MathML"><mn>2</mn> <mo 
class="MathClass-bin">&sdot;</mo> <mn>2</mn></math> </inlineequation>

you can see that &sdot; entity is there. running xmllint tells us that this entity is undefined:

sample.xml:16: parser error : Entity 'sdot' not defined
class="MathClass-bin">&sdot;</mo> <mn>2</mn></math> </inlineequation>

this entity is removed from your document using xtpipes post-processing (invoked by -cdocbk option). So the solution we need to find is to include the cdot as either numeric entity, or direct unicode value. We can try to use different conversion table to unicode than one invoked by -cunihtf. from tex4ht manual

The mzlatex command is a short cut representation for the command ‘htlatex filename "xhtml,mozilla" " -cmozhtf" "-cvalidate"’. It take into account special needs of browsers. The xhmlatex command is a short cut representation for the command ‘htlatex filename "xhtml,mathml" " -cunihtf" "-cvalidate"’; it does not make any compromizes toward browsers.

so we can try to replace -cunihtf with -cmozhtf:

htlatex filename "xhtml,docbook-mml" " -cmozhtf" "-cdocbk"

and the result seems to be fine:

<inlineequation role="inline"><!--l. 7
--><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>2</mn> <mo class="MathClass-bin">&#x22C5;</mo> <mn>2</mn></math> </inlineequation>
michal.h21
  • 50,697