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]
Other format: [Raw text]

Admonition graphics customization


hi,

The following DSSSL customization allow to get admonitions the following
way in PS/PDF:

   _______
  |       |  Admonition text here and there. Admonition text here and
there.
  | Adm.  |  Admonition text here and there. Admonition text here and
there.
  | Graph.|  Admonition text here and there. Admonition text here and
there.
  |       |  Admonition text here and there. Admonition text here and
there.
  |_______|  Admonition text here and there. Admonition text here and
there.
             Admonition text here and there. Admonition text here and
there.


I thaught it might be of interest to some of you.
Many thanks to Pascal Lo Re.

Camille.



;; Define the size of the admonition picture
;; The size must be placed between quotes.
(define %admonImageSize% "24pt")
;; Define the size of the space between the picture and the text
;; and the width of the text
(define %admonColumnSpace% "0.3cm")
(define %admonTextWidth% "9cm")
;; Redifine of the $graphical-admonition$ function
(define ($graphical-admonition$)
  (let* ((adm       (current-node))
         (title     (select-elements (children adm)
                                     (normalize "title")))
         (title?    (not (node-list-empty? title)))
         (adm-title (if title?
                        (with-mode title-sosofo-mode
                          (process-node-list (node-list-first title)))
                        (literal (gentext-element-name adm))))
         (f-child   (node-list-first (children (current-node))))
         (r-child   (node-list-rest (children (current-node)))))
    (make display-group
      space-before: %block-sep%
      space-after: %block-sep%
      start-indent: (+ (inherited-start-indent) ($admon-graphic-width$))
      font-family-name: %admon-font-family%
      font-size: (- %bf-size% 1pt)
      font-weight: 'medium
      font-posture: 'upright
      line-spacing: (* (- %bf-size% 1pt) %line-spacing-factor%)
      (if title?
          (sosofo-append
            (make paragraph
              font-family-name: %title-font-family%
              font-weight: 'bold
              adm-title)
            (make formatting-instruction
              data: (string-append "\\begin{tabular}{rc}\\parbox{"
%admonImageSize% "}{\\includegraphics[width=" %admonImageSize%
",keepaspectratio=true]{" ($admon-graphic$) "}}&\\parbox{"
%admonTextWidth% "}{"))
            (process-children)
            (process-children)
            (make formatting-instruction
              data: "}\\end{tabular}")
          )
          (sosofo-append
            (make formatting-instruction
              data: (string-append "\\begin{tabular}{c@{\\hspace{"
%admonColumnSpace% "}}c}\\parbox{" %admonImageSize%
"}{\\vspace{\\baselineskip}\\includegraphics[width=" %admonImageSize%
",keepaspectratio=true]{" ($admon-graphic$) "}}&\\parbox[t]{"
%admonTextWidth% "}{"))
            (process-node-list (children f-child))
            (process-node-list r-child)
            (make formatting-instruction
              data: "}\\end{tabular}")
          )
      )
  )
 )
)


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