Subject: [Boost-docs] Inline math phrase and fixed interline spacing in html
From: Samuel Debionne (debionne_at_[hidden])
Date: 2007-11-20 10:05:30
Hello all,
I'm using QuickBook/BoostBook for my project and finds it very usefull.
Since it's a scientific computing project, I have a lot of equations in
the user documentation. So far, I follow the method develloped by John
Maddock to create the MathML/PNG/SVG equations and it does a great job
[1]. I use the attached QuickBook template to insert equation,
inleeqation, informalequation [2].
These eqations are explained in a text paragraph which includes math
phrases with (a lot of) super/sub scripts. The transformation goes this
way :
QBK -> DOCBOOK -> HTML
Foo[sub bar] -> Foo<subscript>bar</subscript> -> Foo<sub>bar</sub>
The problem is that html <sub> and <super> makes the interline spacing
variable... and the document ugly. A solution is to use CSS for sub and
super script.
QBK -> DOCBOOK -> HTML
Foo[sub sat] -> Foo<subscript role="math">barsubscript role="math"> ->
Foo<span class="subscript">bar</span>
I added the following int he customization layer for html (html.xsl) :
<xsl:template match="superscript[@role = 'math']">
<xsl:param name="content">
<xsl:call-template name="anchor"/>
<xsl:call-template name="simple.xlink">
<xsl:with-param name="content">
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:param>
<span class="math-superscript">
<xsl:copy-of select="$content"/>
</span>
</xsl:template>
<xsl:template match="subscript[@role = 'math']">
<xsl:param name="content">
<xsl:call-template name="anchor"/>
<xsl:call-template name="simple.xlink">
<xsl:with-param name="content">
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:param>
<span class="math-subscript">
<xsl:copy-of select="$content"/>
</span>
</xsl:template>
And in the css :
p
{
text-align: left;
font-size: 10pt;
line-height: 1.5; /* not the greater spacing */
}
.math-superscript
{
position: relative;
bottom: 0.5em;
font-size: 0.8em;
}
.math-subscript
{
position: relative;
top: 0.3em;
font-size: 0.8em;
}
Hoping it could help,
Samuel
[1] I noticed that a much "smoother" PNG file can be obtained directly
from MathCast (rather that using Batik) when the Windows XP ClearType
options is set.
[2] To be added to the upcoming quickbook template library ? Is there any
place to contribute ?
This archive was generated by hypermail 2.1.7 : 2017-11-11 08:50:40 UTC