From 40220a2365104a2807caf2fcf895f83e1a21539a Mon Sep 17 00:00:00 2001
From: Ludovic Courtes
Date: Sun, 24 Jun 2007 19:52:01 +0000
Subject: eq: Implemented equation numbering.

* src/guile/skribilo/package/base.scm (chapter): Augmented environment to
  include `equation-env' and `equation-counter'.

* src/guile/skribilo/package/eq.scm: Use `(skribilo resolve)'.
  (equation-number-string): New.
  (eq)[:number]: New option.
  Handle it.

* src/guile/skribilo/package/eq/lout.scm (eq): Prepare to handle
  `:number'.

git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-118
---
 src/guile/skribilo/package/base.scm    |  3 ++-
 src/guile/skribilo/package/eq.scm      | 34 +++++++++++++++++++++++++++++++---
 src/guile/skribilo/package/eq/lout.scm | 19 +++++++++++--------
 3 files changed, 44 insertions(+), 12 deletions(-)

(limited to 'src')

diff --git a/src/guile/skribilo/package/base.scm b/src/guile/skribilo/package/base.scm
index 29eb2df..28cd0fb 100644
--- a/src/guile/skribilo/package/base.scm
+++ b/src/guile/skribilo/package/base.scm
@@ -203,7 +203,8 @@
 		 ,@(the-options opts :ident :class)))
       (body (the-body opts))
       (env (list (list 'section-counter 0) (list 'section-env '())
-		 (list 'footnote-counter 0) (list 'footnote-env '())))))
+		 (list 'footnote-counter 0) (list 'footnote-env '())
+                 (list 'equation-counter 0) (list 'equation-env '())))))
 
 ;*---------------------------------------------------------------------*/
 ;*    section-number ...                                               */
diff --git a/src/guile/skribilo/package/eq.scm b/src/guile/skribilo/package/eq.scm
index 9b03aef..211a9bd 100644
--- a/src/guile/skribilo/package/eq.scm
+++ b/src/guile/skribilo/package/eq.scm
@@ -27,7 +27,8 @@
   :use-module (skribilo utils syntax)
   :use-module (skribilo utils keywords) ;; `the-options', etc.
   :autoload   (skribilo package base) (it symbol sub sup)
-  :autoload   (skribilo engine lout) (lout-illustration)
+  :autoload   (skribilo engine lout)  (lout-illustration)
+  :autoload   (skribilo resolve)      (resolve-counter)
 
   :use-module (srfi srfi-1)
   :use-module (srfi srfi-39)
@@ -207,6 +208,18 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g.,
 	(current-module)))
 
 
+(define-public (equation-number-string equation)
+  "Return an appropriate document-wide number for @var{equation}."
+  (and (is-markup? equation 'eq)
+       (not (inline-equation? equation))
+       (let ((num (markup-option equation :number)))
+         (and (number? num)
+              (let ((chapter (ast-chapter equation)))
+                (and (markup? chapter)
+                     (string-append
+                      (number->string (markup-option chapter :number)) "."
+                      (number->string num))))))))
+
 
 ;;;
 ;;; Markup.
@@ -224,7 +237,8 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g.,
 (define-markup (eq :rest opts :key (ident #f) (class "eq")
                                    (inline? 'auto) (align-with #f)
 		                   (renderer #f) (div-style 'over)
-                                   (mul-style 'space))
+                                   (mul-style 'space)
+                                   (number #f))
   (new container
        (markup 'eq)
        (ident (or ident (symbol->string (gensym "eq"))))
@@ -232,9 +246,23 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g.,
        (loc   &invocation-location)
        (options `((:div-style ,div-style) (:align-with ,align-with)
                   (:mul-style ,mul-style) (:inline? ,inline?)
+                  (:number ,(cond ((not number)     #f)
+                                  ((string? number) number)
+                                  (else
+                                   (new unresolved
+                                      (proc (lambda (n e env)
+                                              (let* ((p? (assq 'parent env))
+                                                     (p  (and (pair? p?)
+                                                              (cadr p?))))
+                                                (and (is-markup? p 'eq)
+                                                     (not (inline-equation? p))
+                                                     (resolve-counter n env
+                                                                      'equation
+                                                                      number)))))))))
                   ,@(the-options opts
                                  :ident :class :inline?
-                                 :div-style :mul-style :align-with)))
+                                 :div-style :mul-style :align-with
+                                 :number)))
        (body (let loop ((body (the-body opts))
 			(result '()))
 	       (if (null? body)
diff --git a/src/guile/skribilo/package/eq/lout.scm b/src/guile/skribilo/package/eq/lout.scm
index 9b27a7e..017b1f8 100644
--- a/src/guile/skribilo/package/eq/lout.scm
+++ b/src/guile/skribilo/package/eq/lout.scm
@@ -57,20 +57,23 @@
    :after  "\n@EndAlignedDisplays\n")
 
 (markup-writer 'eq (find-engine 'lout)
-   :options '(:inline? :align-with :div-style :mul-style)
+   :options '(:inline? :align-with :div-style :mul-style :number)
    :before (lambda (node engine)
              (let* ((parent (ast-parent node))
-                    (displayed? (is-markup? parent 'eq-display)))
+                    (displayed? (is-markup? parent 'eq-display))
+                    ;;(number (equation-number-string node))
+                    )
+               ;; FIXME: Use NUMBER when `@BypassNumber' is available.
                (format #t "~a{ "
                        (if (and displayed? (not (*embedded-renderer*)))
                            "\n@IAD " ""))))
    :action (lambda (node engine)
-	     (display (if (inline-equation? node)
-			  "@OneRow @OneCol @E { "
-			  "@Eq { "))
-	     (let ((eq (markup-body node)))
-	       ;;(fprint (current-error-port) "eq=" eq)
-	       (output eq engine)))
+             (display (if (inline-equation? node)
+                          "@OneRow @OneCol @E { "
+                          "@Eq { "))
+             (let ((eq (markup-body node)))
+               ;;(fprint (current-error-port) "eq=" eq)
+               (output eq engine)))
    :after  " } }")
 
 
-- 
cgit v1.2.3


From 699590eb680344df7283943e5b0f32667deae615 Mon Sep 17 00:00:00 2001
From: Ludovic Courtes
Date: Sun, 24 Jun 2007 19:53:02 +0000
Subject: eq/lout: Use the new `@BypassNumber' option for numbered displays.

* src/guile/skribilo/package/eq.scm (eq)[number]: Default to `#t'.

* src/guile/skribilo/package/eq/lout.scm (eq): Use `@CAND'/`@CAD' instead
  of `@IAD' (because `@IAND' is broken).  Handle `:number'.

git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-119
---
 ChangeLog                              | 20 ++++++++++++++++++++
 src/guile/skribilo/package/eq.scm      |  2 +-
 src/guile/skribilo/package/eq/lout.scm | 14 ++++++++------
 3 files changed, 29 insertions(+), 7 deletions(-)

(limited to 'src')

diff --git a/ChangeLog b/ChangeLog
index be980d9..bcbcb1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,26 @@
 # arch-tag: automatic-ChangeLog--skribilo@sv.gnu.org--2006/skribilo--devo--1.2
 #
 
+2007-06-24 19:53:02 GMT	Ludovic Courtes <ludovic.courtes@laas.fr>	patch-119
+
+    Summary:
+      eq/lout: Use the new `@BypassNumber' option for numbered displays.
+    Revision:
+      skribilo--devo--1.2--patch-119
+
+    * src/guile/skribilo/package/eq.scm (eq)[number]: Default to `#t'.
+    
+    * src/guile/skribilo/package/eq/lout.scm (eq): Use `@CAND'/`@CAD' instead
+      of `@IAD' (because `@IAND' is broken).  Handle `:number'.
+
+    modified files:
+     ChangeLog src/guile/skribilo/package/eq.scm
+     src/guile/skribilo/package/eq/lout.scm
+
+    new patches:
+     lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-107
+
+
 2007-06-24 19:52:01 GMT	Ludovic Courtes <ludovic.courtes@laas.fr>	patch-118
 
     Summary:
diff --git a/src/guile/skribilo/package/eq.scm b/src/guile/skribilo/package/eq.scm
index 211a9bd..31b297d 100644
--- a/src/guile/skribilo/package/eq.scm
+++ b/src/guile/skribilo/package/eq.scm
@@ -238,7 +238,7 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g.,
                                    (inline? 'auto) (align-with #f)
 		                   (renderer #f) (div-style 'over)
                                    (mul-style 'space)
-                                   (number #f))
+                                   (number #t))
   (new container
        (markup 'eq)
        (ident (or ident (symbol->string (gensym "eq"))))
diff --git a/src/guile/skribilo/package/eq/lout.scm b/src/guile/skribilo/package/eq/lout.scm
index 017b1f8..dff7c66 100644
--- a/src/guile/skribilo/package/eq/lout.scm
+++ b/src/guile/skribilo/package/eq/lout.scm
@@ -61,12 +61,14 @@
    :before (lambda (node engine)
              (let* ((parent (ast-parent node))
                     (displayed? (is-markup? parent 'eq-display))
-                    ;;(number (equation-number-string node))
-                    )
-               ;; FIXME: Use NUMBER when `@BypassNumber' is available.
-               (format #t "~a{ "
-                       (if (and displayed? (not (*embedded-renderer*)))
-                           "\n@IAD " ""))))
+                    (number (equation-number-string node)))
+               ;; Note: The `@BypassNumber' option appeared in Lout 3.36.
+               (if (and displayed? (not (*embedded-renderer*)))
+                   (display (if (string? number)
+                                (string-append "@CAND @BypassNumber { \""
+                                               number "\" }")
+                                "@CAD")))
+               (display " { ")))
    :action (lambda (node engine)
              (display (if (inline-equation? node)
                           "@OneRow @OneCol @E { "
-- 
cgit v1.2.3


From 0987800d0caf8371a2b25e285e233bd5e7e66aec Mon Sep 17 00:00:00 2001
From: Ludovic Courtes
Date: Sun, 24 Jun 2007 19:53:56 +0000
Subject: eq/lout: Fixed spacing around in-line equations.

* src/guile/skribilo/package/eq/lout.scm (eq): Don't output a space
  in front of in-line equations.

git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-121
---
 ChangeLog                              | 17 +++++++++++++++++
 src/guile/skribilo/package/eq/lout.scm |  6 +++---
 2 files changed, 20 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/ChangeLog b/ChangeLog
index eebe94f..8f75a07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,23 @@
 # arch-tag: automatic-ChangeLog--skribilo@sv.gnu.org--2006/skribilo--devo--1.2
 #
 
+2007-06-24 19:53:56 GMT	Ludovic Courtes <ludovic.courtes@laas.fr>	patch-121
+
+    Summary:
+      eq/lout: Fixed spacing around in-line equations.
+    Revision:
+      skribilo--devo--1.2--patch-121
+
+    * src/guile/skribilo/package/eq/lout.scm (eq): Don't output a space
+      in front of in-line equations.
+
+    modified files:
+     ChangeLog src/guile/skribilo/package/eq/lout.scm
+
+    new patches:
+     lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-109
+
+
 2007-06-24 19:53:32 GMT	Ludovic Courtes <ludovic.courtes@laas.fr>	patch-120
 
     Summary:
diff --git a/src/guile/skribilo/package/eq/lout.scm b/src/guile/skribilo/package/eq/lout.scm
index dff7c66..577f6da 100644
--- a/src/guile/skribilo/package/eq/lout.scm
+++ b/src/guile/skribilo/package/eq/lout.scm
@@ -66,9 +66,9 @@
                (if (and displayed? (not (*embedded-renderer*)))
                    (display (if (string? number)
                                 (string-append "@CAND @BypassNumber { \""
-                                               number "\" }")
-                                "@CAD")))
-               (display " { ")))
+                                               number "\" } ")
+                                "@CAD ")))
+               (display "{ ")))
    :action (lambda (node engine)
              (display (if (inline-equation? node)
                           "@OneRow @OneCol @E { "
-- 
cgit v1.2.3