[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: DOCBOOK: Transforming SGML
--7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 07, 2002 at 10:54:01PM +0100, Jirka Kosek wrote: >=20 > If you think it is appropriate, you can customize DocBook and remove > required graphic element from equation and customize stylesheets to do > right thing for you. You should carefully consider interchange problems > between standard DocBook and your customization which can arise later. >=20 Ok, as a test I've done that. With the following stylesheet extension an 'img src' filename is created on the fly, both in the html, and in a file called equations-list, which is post-processed later to create the actual graphics. The contents of the <alt> sub-element in the <.*equation> elements is stuffed into the equations-list too. It all works fine, except for a side effect that I can't determine the cause of. Any <inlineequation> elements that are in <footnote> </footnote> elements, like the example following, don't get rendered: <footnote> <para> Our connection to nature is through our senses. One of these is sight which uses the electromagnetic phenomena in a very narrow band of frequencies. This mathematical phenomena scales everything we observe through the eye, even if it is transformed by other devices, with the large number <inlineequation> <alt>$ 3 . 10 ^{10} $</alt> </inlineequation>, the velocity of light in meters per second. </para> </footnote>. The result is: <td align=3D"LEFT" valign=3D"TOP" width=3D"95%"> <p align=3D"justify">Our connection to nature is through our senses. One of these is sight which uses the electromagnetic phenomena in a very narrow band of frequencies. This mathematical phenomena scales everything we observe through the eye, even if it is transformed by other devices, with the large number , the velocity of light in meters per second.</p> </td> Is there something obvious that I'm missing? The equations-list file contains the equation: <texequation fileref=3D"equations/equation5.png" >$ 3 . 10 ^{10} $</texequation> So near, but not quite there. :) Joe p.s. here's the .dsl fragment. <!-- DSSSL Stylesheet fragment HTMLMath.dsl Allin Cottrell <cottrell@wfu.edu>, November 2001. Automatic filename generation added by Josef Karthauser <joe@tao.org.uk>, January 2002. --> ;; User-configurable options (define $latexopt$=20 ;; Option(s) to pass in relation to LaTeX article document class ;; Set to empty string "" for no option "12pt") (define $usepackage$ ;; LaTeX packages to load? ;; Set to empty string "" for no packages ;; Can use, e.g., "mathtime" to use MathTime fonts ;; "mathtime") =20 "") (define $density$ ;; Density specification for equation bitmaps ;; This will be passed to the "convert" program "96x96") ;; End of user-configurable options (root (make sequence (process-math) (with-mode create-graphic-names (process-children)) (with-mode manifest (process-children)) (if html-index (with-mode htmlindex (process-children)) (empty-sosofo)))) ;; Define the name of the graphic containing the equation. (define (make-eqn-filename nd) (string-append "equations/equation" (format-number (element-number) "1") ".png")) (define (make-eqn-img-src nd) (make element gi: "img" attributes: (list (list "align" "CENTER") (list "src" (make-eqn-filename (current-node)))))) ;; Link the graphic for equations. (mode create-graphic-names (element (inlineequation graphic) (empty-sosofo)) (element inlineequation (make-eqn-img-src (current-node))) (element (equation graphic) (empty-sosofo)) (element equation (make-eqn-img-src (current-node))) (element (informalequation graphic) (empty-sosofo)) (element informalequation (make-eqn-img-src (current-node)))) ;; How to write out an equation into the equation listing file (define (write-eqn nd) (let ((texmath (select-elements (children (current-node))=20 (normalize "alt"))) (graphic (select-elements (children (current-node))=20 (normalize "graphic")))) (make element gi: "texequation" attributes:=20 (list=20 (list "fileref" (make-eqn-filename (current-node)) )) (literal (data texmath))))) ;; Special processing mode to extract equations (mode htmlmath (default (let ((infeqns (select-elements (descendants (current-node)) (normalize "informalequation"))) (eqns (select-elements (descendants (current-node)) (normalize "equation"))) (inleqns (select-elements (descendants (current-node)) (normalize "inlineequation")))) (with-mode htmlmath (process-node-list=20 (node-list infeqns eqns inleqns))))) (element equation (write-eqn (current-node))) (element informalequation (write-eqn (current-node))) (element inlineequation (write-eqn (current-node)))) ;; Write equation info to equation-list.sgml (define (process-math) (make entity system-id: "equations-list" (make element gi: "equation-set" attributes: (list (list "latexopt" $latexopt$) (list "density" $density$) (list "usepackage" $usepackage$)) (with-mode htmlmath (process-children))))) --7JfCtLOvnd9MIVvH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjw7m38ACgkQXVIcjOaxUBbGDwCgrJ9wmjh9rFAa5TvDjJtHqJbF 3UwAoNhiFHwhOmqg5gV8iGN52Eie+C1W =7ABy -----END PGP SIGNATURE----- --7JfCtLOvnd9MIVvH--
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC