summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès2007-11-29 17:44:10 +0100
committerLudovic Courtès2007-11-29 17:44:10 +0100
commit57e103394f1500eb7ad21c350638e6481a4fb9d6 (patch)
treec69632acd318263f794b07b75d4cb48faf515a9b
parent2fadd039d81bab15cec87529a5b160d2f1df1e0e (diff)
downloadskribilo-57e103394f1500eb7ad21c350638e6481a4fb9d6.tar.gz
skribilo-57e103394f1500eb7ad21c350638e6481a4fb9d6.tar.lz
skribilo-57e103394f1500eb7ad21c350638e6481a4fb9d6.zip
slide: Fix `latex' engine's use of colors.
* src/guile/skribilo/engine/latex.scm: Export `skribe-color->latex-rgb'.

* src/guile/skribilo/package/slide/latex.scm: No longer rely on
  `skribe-get-latex-color', use `skribe-color->latex-rgb' and the
  "[rgb]{r,g,b}" form, although it's unclear whether ADVI supports it.
-rw-r--r--src/guile/skribilo/engine/latex.scm3
-rw-r--r--src/guile/skribilo/package/slide/latex.scm32
2 files changed, 20 insertions, 15 deletions
diff --git a/src/guile/skribilo/engine/latex.scm b/src/guile/skribilo/engine/latex.scm
index c68ac89..727f127 100644
--- a/src/guile/skribilo/engine/latex.scm
+++ b/src/guile/skribilo/engine/latex.scm
@@ -39,7 +39,8 @@
   :use-module (ice-9 receive)
 
   :export (latex-engine
-           LaTeX TeX !latex))
+           LaTeX TeX !latex
+           skribe-color->latex-rgb))
 
 (fluid-set! current-reader %skribilo-module-reader)
 
diff --git a/src/guile/skribilo/package/slide/latex.scm b/src/guile/skribilo/package/slide/latex.scm
index f80aaee..825f281 100644
--- a/src/guile/skribilo/package/slide/latex.scm
+++ b/src/guile/skribilo/package/slide/latex.scm
@@ -1,7 +1,7 @@
 ;;; latex.scm  --  LaTeX implementation of the `slide' package.
 ;;;
-;;; Copyright 2003, 2004  Manuel Serrano
 ;;; Copyright 2007  Ludovic Courtès <ludo@chbouib.org>
+;;; Copyright 2003, 2004  Manuel Serrano
 ;;;
 ;;;
 ;;; This program is free software; you can redistribute it and/or modify
@@ -29,7 +29,7 @@
   :use-module (skribilo ast)
   :use-module (skribilo lib)
   :autoload   (skribilo evaluator)     (evaluate-document)
-  :autoload   (skribilo engine latex)  (skribe-get-latex-color)
+  :autoload   (skribilo engine latex)  (skribe-color->latex-rgb)
 
   :autoload   (ice-9 regex)            (string-match)
   :use-module (ice-9 match)
@@ -252,33 +252,37 @@
 	 (display "\\adviplay")
 	 (let ((c (markup-option n :color)))
 	    (when c
-	       (display "[")
-	       (display (skribe-get-latex-color c))
-	       (display "]")))
+               ;; XXX: It's unclear from the ADVI manual whether the `color'
+               ;; argument of `\adviplay' can be specified in a
+               ;; "[model]{spec}" form.  If it can't, then we'd have to use
+               ;; `\definecolor'.  See the `context' engine for an example.
+	       (display "[[rgb]{")
+	       (display (skribe-color->latex-rgb c))
+	       (display "}]")))
 	 (format #t "{~a}" (markup-option n :tag)))
       ;; advi play*
       (define (advi-play* n e)
-	 (let ((c (skribe-get-latex-color (markup-option n :color)))
-	       (d (skribe-get-latex-color (markup-option n :scolor))))
+	 (let ((c (skribe-color->latex-rgb (markup-option n :color)))
+	       (d (skribe-color->latex-rgb (markup-option n :scolor))))
 	    (let loop ((lbls (markup-body n))
 		       (last #f))
 	       (when last
-		  (display "\\adviplay[")
+		  (display "\\adviplay[[rgb]{")
 		  (display d)
-		  (format #t "]{~a}" last))
+		  (format #t "}]{~a}" last))
 	       (when (pair? lbls)
 		  (let ((lbl (car lbls)))
 		     (match lbl
 			((id col)
-			 (display "\\adviplay[")
-			 (display (skribe-get-latex-color col))
-			 (display (string-append "]{" id "}"))
+			 (display "\\adviplay[[rgb]{")
+			 (display (skribe-color->latex-rgb col))
+			 (display (string-append "}]{" id "}"))
 			 (evaluate-document (slide-pause) e)
 			 (loop (cdr lbls) id))
 			(else
-			 (display "\\adviplay[")
+			 (display "\\adviplay[[rgb]{")
 			 (display c)
-			 (format #t "]{~a}" lbl)
+			 (format #t "}]{~a}" lbl)
 			 (evaluate-document (slide-pause) e)
 			 (loop (cdr lbls) lbl))))))))
       (engine-custom-set! le 'documentclass