summaryrefslogtreecommitdiff
path: root/src/guile
diff options
context:
space:
mode:
authorLudovic Court`es2006-11-28 14:05:13 +0000
committerLudovic Court`es2006-11-28 14:05:13 +0000
commite0101950f601d38176410848840882d51ec90b9b (patch)
tree6e7f92de9c73e253a9acdf99a26613f4cca83456 /src/guile
parent9f08ec317436acb62fb0f47c1ea3f1a1460f88e1 (diff)
downloadskribilo-e0101950f601d38176410848840882d51ec90b9b.tar.gz
skribilo-e0101950f601d38176410848840882d51ec90b9b.tar.lz
skribilo-e0101950f601d38176410848840882d51ec90b9b.zip
eq: Added `limit' and `combinations'.
* src/guile/skribilo/package/eq.scm (%operators): Added `limit' and `combinations'. (eq:limit): New. (eq:combinations): New. (eq:limit): New text-based writer. (eq:combinations): Likewise. * src/guile/skribilo/package/eq/lout.scm (eq:limit): New. (eq:combinations): New. git-archimport-id: lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-82
Diffstat (limited to 'src/guile')
-rw-r--r--src/guile/skribilo/package/eq.scm40
-rw-r--r--src/guile/skribilo/package/eq/lout.scm24
2 files changed, 63 insertions, 1 deletions
diff --git a/src/guile/skribilo/package/eq.scm b/src/guile/skribilo/package/eq.scm
index 58fb77c..c45f698 100644
--- a/src/guile/skribilo/package/eq.scm
+++ b/src/guile/skribilo/package/eq.scm
@@ -54,7 +54,7 @@
(define %operators
'(/ * + - = != ~= < > <= >= sqrt expt sum product script
- in notin apply))
+ in notin apply limit combinations))
(define %symbols
;; A set of symbols that are automatically recognized within an `eq' quoted
@@ -264,6 +264,22 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g.,
(loop (cdr body) (cons first result)))))))))
+(define-markup (eq:limit var lim :rest body :key (ident #f))
+ (new markup
+ (markup 'eq:limit)
+ (ident (or ident (symbol->string (gensym "eq:limit"))))
+ (options `((:var ,var) (:limit ,lim)
+ ,@(the-options body :ident)))
+ (body (the-body body))))
+
+(define-markup (eq:combinations x y :rest opts :key (ident #f))
+ (new markup
+ (markup 'eq:combinations)
+ (ident (or ident (symbol->string (gensym "eq:combinations"))))
+ (options `((:of ,x) (:among ,y)
+ ,@(the-options opts :ident)))
+ (body (the-body opts))))
+
;;;
;;; Text-based rendering.
@@ -434,6 +450,28 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g.,
(output (sup sup*) engine)
(output (sub sub*) engine))))
+(markup-writer 'eq:limit (find-engine 'base)
+ :action (lambda (node engine)
+ (let ((body (markup-body node))
+ (var (markup-option node :var))
+ (limit (markup-option node :limit)))
+ (display "lim (")
+ (output var engine)
+ (output (symbol "->") engine)
+ (output limit engine)
+ (display ", ")
+ (output body engine)
+ (display ")"))))
+
+(markup-writer 'eq:combinations (find-engine 'base)
+ :action (lambda (node engine)
+ (let ((of (markup-option node :of))
+ (among (markup-option node :among)))
+ (display "combinations(")
+ (output of engine)
+ (display ", ")
+ (output among engine)
+ (display ")"))))
diff --git a/src/guile/skribilo/package/eq/lout.scm b/src/guile/skribilo/package/eq/lout.scm
index cce5124..563fdbf 100644
--- a/src/guile/skribilo/package/eq/lout.scm
+++ b/src/guile/skribilo/package/eq/lout.scm
@@ -191,6 +191,30 @@
(display ")"))))
+(markup-writer 'eq:limit (find-engine 'lout)
+ :action (lambda (node engine)
+ (let ((body (markup-body node))
+ (var (markup-option node :var))
+ (limit (markup-option node :limit)))
+ (display "{ lim on { ")
+ (output var engine)
+ (display " --> ")
+ (output limit engine)
+ (display " } } (")
+ (output body engine)
+ (display ") "))))
+
+(markup-writer 'eq:combinations (find-engine 'lout)
+ :action (lambda (node engine)
+ (let ((of (markup-option node :of))
+ (among (markup-option node :among)))
+ (display " { matrix atleft { blpar } atright { brpar } { ")
+ (display "row col { ")
+ (output among engine)
+ (display " } row col { ")
+ (output of engine)
+ (display " } } }\n"))))
+
;;;
;;; Sums, products, integrals, etc.