[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook] Bold and italic type for mathematics
Stephen Taylor wrote:Eh, I see more plain italics than bold-italics.
Mathematicians commonly use bold and italic type to distinguish single-character terms.
No, but they're not necessary. DocBook has tags for declaring mathematics:
Does DocBook have suitable elements?
http://www.docbook.org/tdg/en/html/equation.html
http://www.docbook.org/tdg/en/html/informalequation.html
http://www.docbook.org/tdg/en/html/inlineequation.html
http://www.docbook.org/tdg/en/html/mathphrase.html
To illustrate, here is a DocBook document showing one block-level equation, and one inline. You style them differently.
----------- 8< --------- cut here, foo.dbx ---------- 8< ----------
<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<article>
<para>Newton said:</para>
<equation>F = ma</equation>
<para>
Einstein said,
<mathphrase>E = mc<superscript>2</superscript></mathphrase>.
</para>
</article>
----------- 8< --------- cut here, foo.dbx ---------- 8< ----------
Just reading it, it's easy to imagine what this results in, yes? We haven't tried to style things here, only declare the semantic meaning of the document.
Now we need a DocBook customization layer. Minimally:
----------- 8< --------- cut here, foo.xsl ---------- 8< ----------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- Bring in standard stylesheet -->
<xsl:import href=""http://docbook.sourceforge.net/release/xsl/current/html/chunkfast.xsl"/>
<!-- Allow styling of HTML -->
<xsl:param name="html.stylesheet" select="'foo.css'"/>
<!-- Make 'math' phrases italic; from Stayton book, 4/e -->
<xsl:template match="mathphrase">
<xsl:call-template name="inline.italicseq"/>
</xsl:template>
</xsl:stylesheet>
----------- 8< --------- cut here, foo.xsl ---------- 8< ----------
There's lots more you can add to this. I've cut down one of mine to show only the bits that are on-point here. It says that mathphrase tags are styled directly. We could perhaps do the same here for <equation>, but it isn't necessary. It's more elegant to do it in CSS:
----------- 8< --------- cut here, foo.css ---------- 8< ----------
div.equation-contents {
font-style: italic;
}
----------- 8< --------- cut here, foo.css ---------- 8< ----------
All this might look like a lot of text to avoid a few <i> tags, but it only has to be done once. Thereafter, you ignore it, and just write equations.
---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-help@lists.oasis-open.org
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]