OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

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


Subject: Re: [docbook] Bold and italic type for mathematics


Warren, thanks for the lengthy and detailed reply. 

I have adapted your suggestions and have them working.

Some reservations:
Best
Stephen Taylor


2008/9/11 Warren Young <warren@etr-usa.com>
Stephen Taylor wrote:
Mathematicians commonly use bold and italic type to distinguish single-character terms.

Eh, I see more plain italics than bold-italics.


Does DocBook have suitable elements?

No, but they're not necessary.  DocBook has tags for declaring mathematics:

       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]