This example illustrates how to authoring slides with Skribe. The DVI version must be projected with Advi.

View demo...

slide.skb
;*=====================================================================*/
;*    serrano/prgm/project/skribe/www/examples/slide/slide.skb         */
;*    -------------------------------------------------------------    */
;*    Author      :  Manuel Serrano                                    */
;*    Creation    :  Tue Oct 28 11:28:47 2003                          */
;*    Last change :  Fri Jun  3 16:45:24 2005 (serrano)                */
;*    Copyright   :  2003-05 Manuel Serrano                            */
;*    -------------------------------------------------------------    */
;*    Slides in Skribe                                                 */
;*=====================================================================*/

;*---------------------------------------------------------------------*/
;*    The style                                                        */
;*---------------------------------------------------------------------*/
(skribe-load "style.skr")

;; load the slide style with the proper configuration
(case *mode*
;*    ((advi)                                                          */
;*     (skribe-load "slide.skr" :advi #t))                             */
   ((prosper)
    (skribe-load "slide.skr" :prosper #t))
   (else
    (skribe-load "slide.skr")))

;*---------------------------------------------------------------------*/
;*    sk-expression ...                                                */
;*---------------------------------------------------------------------*/
(define (sk-expression)
   (it "sk-expression"))
(define (sk-expressions)
   (it "sk-expressions"))

;*---------------------------------------------------------------------*/
;*    The document                                                     */
;*---------------------------------------------------------------------*/
(document :title (red (sf (font :size +2. "This is Skribe!")))
:author (author :name (it (magenta "Manuel Serrano, Erick Gallesio"))
                :affiliation [Inria Sophia Antipolis, University of Nice]
                :address (list "" (tt (skribe-url))))

;*---------------------------------------------------------------------*/
;*    First slide                                                      */
;*---------------------------------------------------------------------*/
(include "skribe.skb")

;*---------------------------------------------------------------------*/
;*    Skribe gallery                                                   */
;*---------------------------------------------------------------------*/
(slide :title "Gallery"

(st [A computer program:])
(center 
 (c-prgm :file "C-code.c"))

(st [Images:]) 
(center
 (table
   (tr (td (image :width 75 :height 50 :file "img.jpg"))
       (td (image :width 25 :height 50 :file "img.jpg"))
       (td (image :width 150 :height 50 :file "img.jpg"))))))

;*---------------------------------------------------------------------*/
;*    Syntax                                                           */
;*---------------------------------------------------------------------*/
(slide :title "Skribe Syntax" :vspace 0.3

(st [,(sk-expression):])

(itemize (item [An ,(emph "atom")
                (a ,(red (it "string")), a ,(red (it "number")), ...)])
         (item [A ,(emph "list") of ,(sk-expressions)])
         (item [A ,(emph "text") 
                (,(red (tt [\[...,(blue [,(char ",")(,(it "<expr>"))])...\]])))]))

(slide-vspace 0.3)
(st [Example:])
(center 
 (skribe-prgm :fsize 0 (source :file "syntax.skb")))

(p [is equivalent to:])
(center
 (skribe-prgm :fsize 0 
  [(list "text goodies: " (bold "bold") "and" (it "italic") ".")])))

;*---------------------------------------------------------------------*/
;*    Skribe documents                                                 */
;*---------------------------------------------------------------------*/
(slide :title "Skribe Documents (1/2)" :vspace 0.5

(st [Skribe Document Structure:])
(center
 (skribe-prgm [...
(document :title <sk-expr> :author <sk-expr>
  (abstract <sk-expr>)
  (section :title <sk-expr> 
     ...
     (subsection :title <sk-expr>)
     ...
     (subsection :title <sk-expr>)
     ...)
   ...
   (section :title <sk-expr>))])))

;*--- markup ----------------------------------------------------------*/
(slide :title "Skribe Documents (2/2)" :vspace 0.5
(st [XML markup:])
(center
 (xml-prgm [
<elmt1 attr='val'>
   Some text
   <elmt2>
       for the example
   </elmt2>
</elmt1>]))
(slide-vspace 0.3)
(st [Sk-markup:])
(center
 (skribe-prgm [(elmt1 :attr val \[Some text \,(elmt2 \[for the example\])\])])))

;*---------------------------------------------------------------------*/
;*    Libraries                                                        */
;*---------------------------------------------------------------------*/
(slide :title "Skribe Libraries"

(st [A set of libraries containing the ,(q "usual") facilities. For instance:])

(center (skribe-prgm :file "itemize.skb"))
(slide-vspace 0.1)
(st [Produces the following output text:])
(center (color :bg "#ccccff" :width 90.
           (font :size -2 (include "itemize.skb")))))

;*---------------------------------------------------------------------*/
;*    Dynamic texts                                                    */
;*---------------------------------------------------------------------*/
(slide :title "Dynamic texts (1/3)" :vspace 0.2

(st [Let us assume the factorial table:])
(slide-vspace 0.5)

(center (font :size -1 (color :width 90. :bg "#ccccff" (include "fact.skb")))))

;*--- dynamic texts: the usual solution -------------------------------*/
(slide :title "Dynamic texts (2/3)"

(st [The usual solution:])
(center (skribe-prgm :file "factb.skb")))

;*--- dynamic texts: a better solution --------------------------------*/
(slide :title "Dynamic texts (3/3)"

(st [A better solution:])
(center (skribe-prgm :file "fact.skb")))

;*---------------------------------------------------------------------*/
;*    Conclusion                                                       */
;*---------------------------------------------------------------------*/
(slide :title "Conclusion" :vspace 0.5

(st [Status:])
(itemize (item [Available on-line: ,(tt (ref :url (skribe-url)))])
         (item [Available since a couple of months])
         (item [Used, by the authors, on a daily basis])
         (item [,(magenta (bold [Still too young])) ,(symbol '=>)
          ,(itemize (item [Very few styles have been implemented])
                    (item [It is still necessary to be aware of the
                           targets idiosyncrasies])
                    (item [Difficult to tame the fix-point
                           iteration of the computation model]))]))))

skribe.skb
(slide :title [Skribe]
  (st [Skribe:])
  (itemize 
    (item [A functional programming language based on Scheme])
    (item [A markup language ,(emph [ŕ la]) XML])
    (item [A document ,(blue [is]) a program, 
           a program ,(blue [looks like]) a text with markups]))

  (p [
   ,(st [Example:])
   ,(slide-pause)
   ,(skribe-prgm :file "skribe.skb")]))

syntax.skb
[text goodies: ,(bold "bold") and ,(it "italic").]

itemize.skb
(itemize (item [,(sc [Skribe]) is a dialect of Lisp.])
         (item (description
                 (item :key (tt [foo]) [is a usual Lisp identifier.])
                 (item :key (tt [bar]) [is another one.])))
         (item (enumerate (item [One.])
                          (item [Two.]))))

fact.skb
(define (fact n)
   (if (< n 2) n (* n (fact (- n 1)))))

(define (make-fact-row n)
   (tr (td :align 'center (bold n))
       (td :align 'right (it (fact n)))))

(define (make-fact-table n)
   (apply table :border 1
          (tr (th "n=") (th "fact"))
          (map make-fact-row (iota n 3))))

[The Factorial function: 
 ,(center (font :size -1 (make-fact-table 8)))]

factb.skb
[The Factorial function: 
,(font :size -1 
  (table :border 1
   (tr (th "n=") (th "fact"))
   (tr (td :align 'center (bold 3)) (td :align 'right (it 6)))
   (tr (td :align 'center (bold 4)) (td :align 'right (it 24)))
   (tr (td :align 'center (bold 5)) (td :align 'right (it 120)))
   (tr (td :align 'center (bold 6)) (td :align 'right (it 720)))
   (tr (td :align 'center (bold 7)) (td :align 'right (it 5040)))
   (tr (td :align 'center (bold 8)) (td :align 'right (it 40320)))
   (tr (td :align 'center (bold 9)) (td :align 'right (it 362880)))
   (tr (td :align 'center (bold 10)) (td :align 'right (it 3628800)))))]

style.skr
;*=====================================================================*/
;*    serrano/prgm/project/skribe/www/examples/slide/style.skr         */
;*    -------------------------------------------------------------    */
;*    Author      :  Manuel Serrano                                    */
;*    Creation    :  Mon Jun  3 15:32:25 2002                          */
;*    Last change :  Sun Jan 18 09:02:57 2004 (serrano)                */
;*    Copyright   :  2002-04 Manuel Serrano                            */
;*    -------------------------------------------------------------    */
;*    The local style of the presentation                              */
;*=====================================================================*/

;*---------------------------------------------------------------------*/
;*    colors ...                                                       */
;*---------------------------------------------------------------------*/
(define (green body)
   (fg "darkgreen" body))
(define (red body)
   (fg "red" body))
(define (blue body)
   (bold (fg "darkblue" body)))
(define (magenta body)
   (fg "darkmagenta" body))
(define (orange body)
   (fg "darkorange" body))

;*---------------------------------------------------------------------*/
;*    em ...                                                           */
;*---------------------------------------------------------------------*/
(define (em body)
   (bold (magenta body)))

;*---------------------------------------------------------------------*/
;*    st ...                                                           */
;*---------------------------------------------------------------------*/
(define (st body)
   (sf (red body)))

;*---------------------------------------------------------------------*/
;*    citem ...                                                        */
;*---------------------------------------------------------------------*/
(define-markup (citem #!rest opt #!key (color "black") (shape (math 'bullet)))
   (item (list (fg color shape) " " (the-body opt))))

;*---------------------------------------------------------------------*/
;*    skribe-prgm ...                                                  */
;*---------------------------------------------------------------------*/
(define-markup (skribe-prgm #!rest opt #!key file definition)
   (font :size -4
      (center
         (color :bg "#ccffcc" :width 90.
            (prog :line #f
               (cond
                  ((and definition file)
                   (source :language skribe
                      :file file
                      :definition definition))
                  (file
                   (source :language skribe :file file))
                  (else
                   (source :language skribe (the-body opt)))))))))

;*---------------------------------------------------------------------*/
;*    foreign-prgm ...                                                 */
;*---------------------------------------------------------------------*/
(define-markup (foreign-prgm lang #!rest opt #!key file body)
   (font :size -4
      (center
         (color :bg "#ccccff" :width 90.
                (prog :line #f
                 (if file
                     (source :language lang :file file)
                     (source :language lang body)))))))

;*---------------------------------------------------------------------*/
;*    c-prgm ...                                                       */
;*---------------------------------------------------------------------*/
(define-markup (c-prgm #!rest opt #!key file)
   (foreign-prgm C :file file :body (the-body opt)))

;*---------------------------------------------------------------------*/
;*    xml-prgm ...                                                     */
;*---------------------------------------------------------------------*/
(define-markup (xml-prgm #!rest opt #!key file)
   (foreign-prgm xml :file file :body (the-body opt)))

;*---------------------------------------------------------------------*/
;*    latex configuration ...                                          */
;*---------------------------------------------------------------------*/
(let ((le (find-engine 'latex)))
   (engine-custom-set! le 'transition 'slide)
   (engine-custom-set! le 'usepackage
                       (string-append
                        (engine-custom le 'usepackage)
                        "\\usepackage{pstricks,pst-node,pst-text,pst-3d}\n")))


Last update Wed Jun 30 08:26:02 2010.