[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Getting PassiveTeX to work with DocBook
Due to recurring requests, here's how I get PassiveTeX to work with
recent DocBook XSL-FO style sheets. Note that this is not a general
solution; I took some radical measures that work for me but may be too
restrictive for other users; you may have to tweak some of my
hard-wired parameters or generalize some templates. It may also be
incomplete in that constructs that I have not yet used cause
PassiveTeX problems unknown to me. But it's a starting point that
should get most real-world DocBook files to convert to PDF.
Justus
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version='1.0'>
<!-- Import docbook stylesheet. Or import slides/fo/plain.xsl, or ... -->
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
<!-- Essential templates to prevent PassiveTeX from choking: -->
<!-- Header causes problems, just get rid of it: -->
<xsl:template name="header.content"/>
<!-- Precompute attribute values; PassiveTex is too stupid: -->
<xsl:attribute-set name="component.title.properties">
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="space-before.optimum">
<xsl:value-of select="concat($body.font.master, 'pt')"/>
</xsl:attribute>
<xsl:attribute name="space-before.minimum">
<xsl:value-of select="$body.font.master * 0.8"/>
<xsl:text>pt</xsl:text>
</xsl:attribute>
<xsl:attribute name="space-before.maximum">
<xsl:value-of select="$body.font.master * 1.2"/>
<xsl:text>pt</xsl:text>
</xsl:attribute>
<xsl:attribute name="hyphenate">false</xsl:attribute>
</xsl:attribute-set>
<!-- Don't put in extra fo:block; PassiveTeX gets confused by nested
fo:blocks: -->
<xsl:template match="listitem/*[1][local-name()='para' or
local-name()='simpara']
|glossdef/*[1][local-name()='para' or
local-name()='simpara' or
local-name()='formalpara']
|step/*[1][local-name()='para' or
local-name()='simpara' or
local-name()='formalpara']
|callout/*[1][local-name()='para' or
local-name()='simpara' or
local-name()='formalpara']"
priority="2">
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</xsl:template>
<!-- Here are some adjustments that I find useful; your mileage may vary: -->
<!-- Adjust to work around PassiveTeX spacing bug: -->
<xsl:attribute-set name="list.block.spacing">
<xsl:attribute name="space-before.optimum">0em</xsl:attribute>
<xsl:attribute name="space-before.minimum">0em</xsl:attribute>
<xsl:attribute name="space-before.maximum">0em</xsl:attribute>
<xsl:attribute name="space-after.optimum">1em</xsl:attribute>
<xsl:attribute name="space-after.minimum">0.8em</xsl:attribute>
<xsl:attribute name="space-after.maximum">1.2em</xsl:attribute>
</xsl:attribute-set>
<!-- Remove spurious space preceding equations -->
<!-- informalequation.properties maps directly to
informalobject.properties -->
<xsl:attribute-set name="informal.object.properties">
<xsl:attribute name="space-before.minimum">0em</xsl:attribute>
<xsl:attribute name="space-before.optimum">0em</xsl:attribute>
<xsl:attribute name="space-before.maximum">0em</xsl:attribute>
<xsl:attribute name="space-after.minimum">0em</xsl:attribute>
<xsl:attribute name="space-after.optimum">0em</xsl:attribute>
<xsl:attribute name="space-after.maximum">0em</xsl:attribute>
</xsl:attribute-set>
</xsl:stylesheet>
--
Justus H. Piater, Ph.D. http://www.montefiore.ulg.ac.be/~piater/
Institut Montefiore, B28 Phone: +32-4-366-2279
Université de Liège, Belgium Fax: +32-4-366-2620
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]