3.11 Skribilo User Manual — Figures
Contents↑ Standard Markups

The figure markup shown below produces floating figures. Well, whether the figure is really ``floating'' depends on the engine used (see Chapter 13): printed output as produced by the lout and latex engines do produce floating figures, but on-line output as produced by the html engine does not.

(figure [:multicolumns] [:number #t] [:legend] [:class "figure"] [:ident] body)
:identhtml lout latex context info xml The node identifier.
:classhtml lout latex context info xml The node class.
:legendhtml lout latex context info The legend of the figure. If no :ident is provided to the figure, it uses the legend value as an identifier. In consequence, it is possible to use the :legend value in references.
:numberhtml lout latex context info If the optional argument :number is a number, that number is used as the new Scribe compiler figure counter. If it is #t the compiler automatically sets a number for that figure. If it is #f the figure is numberless.
:multicolumnshtml lout latex context info A boolean that indicates, for back-ends supporting multi-columns rendering (e.g., "TeX"), if the figure spans over all the columns.
bodyThe body of the figure.
See also
ref document
 (figure :legend "This is a unnumbered figure" 
          :ident "fig1"
          :number #f
          (frame [Skribe is a functional programming language.])))

 (figure :legend "The great Penguin" 
          (image :file "linux.png")))
Ex. 15: The figure markup

Skribe is a functional programming language.

Fig. : This is a unnumbered figure

Fig. 1: The great Penguin

3.11.1 List of Figures

Skribilo has no built-in facility to display the list of figures. Instead, it provides a general machinery for displaying any kind of lists of items contained in a document. This is described in the section [?section Resolve: ./figure.skb:65:10:] and Introspection. For the sake of simplicity, an example showing how to display the list of figures of a document is included below.

(resolve (lambda (n e env)
             (let* ((d (ast-document n))
                    (ex (container-env-get d 'figure-env)))
                (table (map (lambda (e)
                               (tr (td :align 'left
                                       (markup-option e ':number)
                                       " "
                                       (ref :handle (handle e)
                                            :text (markup-option e :legend))
                                       " (section "
                                       (let ((c (ast-section e)))
                                          (ref :handle (handle c)
                                               :text (markup-option c :title)))
                            (sort ex
                                  (lambda (e1 e2)
                                     (let ((n1 (markup-option e1 :number))
                                           (n2 (markup-option e2 :number)))
                                           ((not (number? n1))
                                           ((not (number? n2))
                                            (< n1 n2)))))))))))
Ex. 16: The figure markup

... produces:

This is a unnumbered figure (section Figures)
1 The great Penguin (section Figures)
(made with skribilo)