This is the mail archive of the docbook@lists.oasis-open.org mailing list for the DocBook project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook] theorems and similar things


Hi Wolfgang,
Extending the DocBook XSL stylesheets to handle new elements is pretty
straightforward. The stylesheets are designed to be customized without
editing the original stylesheet files.  You create a customization layer
that has only your customizations and uses the stock stylesheet for
everything else.

Because the stylesheets are driven by templates, you should find an element
that is handled in a manner similar to the way you want your new elements to
be handled.  Then find the XSL template that processes that element and copy
it to your customization file.  Then you change the 'match' attribute so it
applies to your new element, and make any changes to the body of the
template to format it the way you want.  You'll want to make use of the
xsl:number instruction to number your theorems.  Keep a good XSLT reference
handy.  8^)

See this reference for how to get started with a DocBook XSL customization:

http://www.sagehill.net/docbookxsl/CustomMethods.html

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Wolfgang Jeltsch" <wolfgang@jeltsch.net>
To: "DocBook Mailing List" <docbook@lists.oasis-open.org>
Sent: Wednesday, September 15, 2004 11:58 AM
Subject: Re: [docbook] theorems and similar things


> Am Mittwoch, 15. September 2004 20:35 schrieb Shaun McCance:
> > [...]
>
> > No, this isn't the right way to do it.
>
> I agree.
>
> > In mathematical texts, theorems and the like are interleaved with
> > paragraphs.  Structurally, they're very similar to DocBook's formalpara.
> >
> > Wolfgang, ideally, you'd want to extend DocBook for this purpose.
>
> Yes, I already feared that an extension would be the only sensible way to
do
> theorems etc.
>
> > I've actually considered writing such an extension (MathBook?) before,
but
> > I've never gotten around to it.  Then extension itself wouldn't be very
> > difficult.  Just define some new elements (theorem, lemma, corollary,
> > proposition, axiom, definition, proof), give them basically the same
> > content model as formalpara (except you probably want to make titles
> > optional), and add them to %local.para.class;.
>
> Thanks for these hints.
>
> > You would also have to extend whatever processing system you're using to
> > handle these extensions.
>
> I think, that's the problem.  I've read that extending DocBook is rather
easy
> because of the way the DocBook DTD is implemented.  But how about DocBook
> stylesheets?  Are they implemented in a similar extension-friendly way?
Is
> it necessary to directly modify the stylesheet code?  I'd like to avoid
this
> because otherwise I would have to merge all modifications to the
stylesheets
> into my extended stylesheets.
>
> Is an extension with theorems etc. considered for future versions of
DocBook?
> If currently not, it maybe should.
>
> > Shaun
>
> In case you work again on MathBook, could you please tell me?  Or could
you
> assist me in case I try to implement MathBook and stylesheets for it in
the
> future?
>
> Wolfgang
>
>
>



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]