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] Tips for DB Users for Tool Chain (Linux):xsltproc, fop 1.0 [html and pdf]


On Thu, Apr 7, 2011 at 14:01, Matt Dew <marcoz@osource.org> wrote:
> On 04/07/2011 12:54 PM, Tom Browder wrote:
>>
>> I'm not sure it's been pointed out here recently, but two common
>> requirements for good looking docs now have work-arounds for the
>> subject tool chain:
>>
>> 1.  centering tables (using Bob Stayton's suggestion for PI dbfo and
>> css for html)

For centering tables do this in DB (see p. 474 in Bob Stayton's book;
also with help from Dean Nelson <deannelson@aol.com> on this list):

  <table xml:id="_tableX">
    <?dbfo centered-table-width="5.4in" ?>
    <?dbhtml table-width="60%" ?>
    <title>My table</title>
      <tgroup cols="1">
      <!-- etc. -->
  </table>

I find the width needs to be pretty accurate.

The dbfo is in a customization file for fo:

  <xsl:include href="center-table-print.xsl"/>

The "center-table-print.xsl" file is attached zipped.

I had good luck with it.

>> 2.  good looking equations in svg for html and pdf (with free,
>> easy-to-use tools for generating MathML and converting to svg)

This is a delightful find:

1. Create an equation using LibreOffice Math (from http://www.libreoffice.org/).

Use a markup almost identical to LaTex in the bottom pane and see the
results in the upper pane.  It's not obvious but a right-click in the
lower pane brings up a widget with all the usual operators and things.
 You can edit more WYSIWIG in the upper pane but I like having more
control like LaTeX.

Note:  OpenOffice probably works the same but I don't use it any more.

2. Save the file as MathML (.mml).

3. Edit the mml file and REMOVE the <semantics> and </semantics> tags.

4. Get the SVGMath python package (http://sourceforge.net/projects/svgmath/).

I had to unpack the archive with the explicit text option because of
python having problems with dos line endings:

  unzip -aa SVGMath-0.3.3.zip

5. Copy the svgmath.xml file into your working directory and update it
for the fonts you have.

6.  Install the package but be aware that I had to use the "-c" option
when I used the converter program "math2svg.py" in /usr/local/bin"
because, contrary to instructions, that directory was searched instead
of my working directory for the configuration file.

Nikolai has an xsl-fo adjustment file which I haven't had to use yet.

Convert the MathML file:

  math2svg.py -c svgmath.xm -s -o X.svg X.mml

7.  Given an equation file X.svg, in my DB source I did this:

<equation id="X">
<title>General closed-form damage function formula</title>
<informalfigure>
<mediaobject>
  <imageobject role='xhtml'>
    <!-- centering title taken care of in css -->
    <imagedata
       width='3in' scalefit='1'
       fileref="./X.svg"
    />
  </imageobject>
  <imageobject role='fo'>
    <imagedata
       align='center'
       format="SVG"
       fileref="./X.svg"
    />
  </imageobject>
</mediaobject>
</informalfigure>
</equation>

Seems to work okay in html and pdf.

HTH.

Best,

-Tom

center-table-print.xsl.zip



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