This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
RE: [docbook-apps] Mathematics and DocBook
- From: Doug du Boulay <ddb at R3401 dot msl dot titech dot ac dot jp>
- To: "Kevin S. Van Horn" <kvanhorn at ksvanhorn dot com>
- Cc: docbook-apps at lists dot oasis-open dot org
- Date: Thu, 28 Aug 2003 11:04:43 +0900
- Subject: RE: [docbook-apps] Mathematics and DocBook
- Reply-to: ddb at R3401 dot msl dot titech dot ac dot jp
Hi,
sorry to revive a stagnant thread:
Back on Aug 04, 2003 Kevin S. Van Horn wrote:
>3. DBTeXMath. You can produce nicely typeset math this way, but you
>still have the problem of excruciatingly verbose input for the simplest
>thing. For example, just to reference a mathematical variable N I have
>to write
> <inlineequation>
> <inlinemediaobject>
> <imageobject role="html">
> <imagedata fileref="texmath1.png" format="PNG"/>
> </imageobject>
> <textobject role="tex"><phrase>$N$</phrase></textobject>
> </inlinemediaobject>
> </inlineequation>
If you are only interested in HTML output, I have a hack on the XSL
(located here: http://r3401.msl.titech.ac.jp/~ddb/docbook/ )
stylesheets that automatically generates the image filename from the
equation sequence number. Because of that you can simplify the associated
cruft down to a couple of simple entity references.
I use the entity definitions
<!ENTITY inleqo "<inlineequation><alt role='tex'>\(">
<!ENTITY inleqc "\)</alt></inlineequation>">
<!ENTITY cinfeqo "<informalequation role='cont'><alt role='tex'>">
<!ENTITY infeqo "<informalequation><alt role='tex'>">
<!ENTITY infeqc "</alt></informalequation>">
<!ENTITY ceqo "<equation role='cont'><alt role='tex'>">
<!ENTITY teqo "<equation role='terminal'><alt role='tex'>">
<!ENTITY eqo "<equation><alt role='tex'>">
<!ENTITY eqc "</alt></equation>">
and then type inline equations as &inleqo;x^2&inleqc;
and informal equations as
&infeqo;\[
\Tensor{g} =
\left[
\begin{array}{llll}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \end{array}
\right] \]
&infeqc;
ditto for formal numbered equations with &eqo;and &eqc;
but using the stylesheets to generate the equation label in the HTML, where I
believe it should being done, rather than doing it in latex.
If you want to reference a particular labeled equation of course you still
need to type explicitly
<equation id="myrefedeq2"><alt role="tex">
\begin{align*} ...\end{align*}
</alt></equation>
and then reference to equation <xref linkend="myrefedeq2"/>
The role="cont" and role="terminal" variants were used to try and
preserve worked equation alignments across paragraphs, which I thought looked
a little bit nicer as well as permitting informal and formal components to be
mixed and matched in the same series of equation steps as:
&cinfeqo; \begin{align*}
d\Vector{v} &= \Tensor{T} d\Vector{r}\\
&infeqc;
you can type small inline equations between the previous and next segments and
still preserve the alignment when you terminate with the &teqo;
&teqo; &= \left[{dr}\Vector{e}_r+r{d\theta}\Vector{e}_\theta+r
\sin{\theta}{d\phi}\Vector{e}_\phi+
r\sin{\theta}\sin{\phi}{d\phi}{\Vector{e}_\psi} \right]
\end{align*}
&eqc;
It isn't as flexible as might be desired because if you use latex math case
statements and require individual case labels you are out of luck, but
certainly it beats the long hand way of encoding it and keeping track of
equation image labels in both latex and the docbook xml.
I tried to document what I was doing some time back, but got sidetracked and
then lost interest. Wasn't sure how the approach would work
for going to print directly in latex iether, so the incentive to
polish it wasn't there.
It requires overrides of at least formal.xsl and math.xsl from the html
stylesheets, as well as a significant customization of the document specific
stylesheet.
Many thanks to Jirka Kosek who I believe wrote the original xsl dbtexmath
stuff, without which I wouldn't have even started experimenting.
Disclaimer: It was my first and last experiment with xsl so probably it isn't
hacked as nice as it aught to be. And sorry, it's only half a solution, and
maybe it doesn't work for chunked html.
Hopefully though, it might be of some use to someone...
Doug
P.S. I don't subscribe to the docbook lists anymore, just browse the oasis
lists occasionally (hence the delayed response) so please email direct if
there are relevant queries.
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org.