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


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

Re: How to do floating images


Rick Bronson wrote:

> Hi,
>
>   I've combed the mailing list and haven't found a way to do floating
> images on either print or html.  I'm using Docbook 4.1, dsssl-1.71,
> jadetex version 3.3.1
>
>   Anyone figured it out?
>
> [snip]
>
>   Rick

I wrote a message some time ago about it. I use the similar mechanism that
$admonition, but I add a "position-point-y:" stament to get the image
vertically shifted.

What I do is use a Docbook Tag: <blockquote role="graphdesc">. Then I use:

<blockdata><graphic ...></graphic><para>...</para>

The <para> get around the graphic.

This is the DSSSL code:

;;========================================================
(define ($block-graph$ #!optional (nd (current-node)) (display #f))
  (let* ((fileref   (attribute-string (normalize "fileref") nd))
  (entityref (attribute-string (normalize "entityref") nd))
  (format    (if (attribute-string (normalize "format") nd)
   (attribute-string (normalize "format") nd)
   (if entityref
       (entity-notation entityref)
       #f)))
  (para-nd (node-list-first (select-elements (children (current-node))
(normalize "para"))))
  ;; (para-nd (select-elements (children (current-node)) (normalize
"para")))
  (txt (children para-nd))
  (height    (measurement-to-length (attribute-string "depth" nd)))
  (width     (measurement-to-length (attribute-string "width" nd)))
  (finalfileref ( if fileref fileref
       (if entityref entityref "")))
  (graphic (make external-graphic
    display?: #f
    ;; position-point-y: (-(+ %bf-size% height))
    position-point-y: (- %bf-size% height)
    entity-system-id: (graphic-file fileref))))
    (if finalfileref
 (make display-group
   space-before: %para-sep%
   space-after: %para-sep%
   start-indent: (+ (+ (inherited-start-indent) width) %graphdesc-margin%)
   font-family-name: %body-font-family%
   font-size: %bf-size%
   (make display-group
     space-after: %para-sep%
     (make paragraph
       first-line-start-indent: (- (+ width %graphdesc-margin%) )
       (make line-field
  field-width: (+ width %graphdesc-margin%)
  graphic)
       (process-node-list txt))))
 (empty-sosofo))))

(element blockquote
  (let* ((nlg (select-elements (children (current-node)) (normalize
"graphic")))
  ( isgraph? ( and
         (equal? (attribute-string "role") "graphdesc")
         (not (node-list-empty? nlg)))))
    (if isgraph?
 ($block-graph$ (node-list-first nlg))
 (make paragraph
   font-size: (* %bf-size% %smaller-size-factor%)
   line-spacing: (* %bf-size% %line-spacing-factor%
      %smaller-size-factor%)
   space-before: %para-sep%
   start-indent: (+ (inherited-start-indent) 1em)
   end-indent: 1em
   (process-children)))))
;; ====================================================================

You can extend it to allow several <para>. To do so, you must play with the

inherited-indent propiety and treat <para> in an special way when it occurs

inside those <blockquote>.
(I haventītried this last option but Iīm sure it can be done).

Hope this help.

P.D: This is for PRINTED output. I think HTML may be fairly easier.

Juan R. Migoya
SPAIN




------------------------------------------------------------------
To unsubscribe from this elist send a message with the single word
"unsubscribe" in the body to: docbook-apps-request@lists.oasis-open.org


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