6.2.4. page-sequence の例

page-sequence の例として、本書のような見開きの体裁を扱ってみることにしましょう。リスト 6.1のような DTD に対し、chapter タグが現れるたびに奇数(front)ページから開始するものとします。部分的な例になりますが、この場合の page-sequenceの指定は概ねリスト 6.2のようになります。

リスト 6.1 [ book.dtd ]
<!ELEMENT book          (bookinfo?,...,chapter+,...)>
<!ELEMENT chapter       (...)>
リスト 6.2 [ twoside.dsl ]
(define %page-width% 210mm)
(define %page-height% 297mm)
(define %top-margin% 30mm)
(define %bottom-margin% 20mm)
(define %inside-margin% 40mm)
(define %outside-margin% 30mm)
(define %body-width% (- %page-width% %inside-margin% %outside-margin%))
(define %body-height% (- %page-width% %top-margin% %bottom-margin%))
(define %footer-height% 20mm)

(define (page-footer)
  (make display-group
    (make rule
      orientation: ’horizontal
      length: %body-width%
      line-thickness: 0.1pt
      display-alignment: ’start
      space-after: 1pt)
    (make paragraph
      font-family-name: "Helvetica"
      font-size: 9pt
      line-spacing: 9pt
      quadding: ’center
      (page-number-sosofo))))

(define-page-model front-page
  (width %page-width%)
  (height %page-height%)
  (filling-direction ’top-to-bottom)
  (region
    (x-origin %inside-margin%)
    (y-origin %bottom-margin%)
    (width %body-width%)
    (height %body-height)
    (footer
      (width %body-width%)
      (height %footer-height%)
      (generate (page-footer)))))
      
(define-page-model back-page
  (width %page-width%)
  (height %page-height%)
  (filling-direction ’top-to-bottom)
  (region
    (x-origin %outside-margin%)
    (y-origin %bottom-margin%)
    (width %body-width%)
    (height %body-height)
    (footer
      (width %body-width%)
      (height %footer-height%)
      (generate (page-footer)))))

(element chapter
  (make page-sequence
    repeat-page-models: ’(front-page back-page)
    force-first-page: ’front))

<<prev      next>>