aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtes2006-12-02 10:42:56 +0000
committerLudovic Courtes2006-12-02 10:42:56 +0000
commit32136d000be5c570133c48c3650d5d7b51efa2fc (patch)
tree6e7f92de9c73e253a9acdf99a26613f4cca83456
parent9d5dfa5b32e1dcf98cb4878322d00150477a8225 (diff)
downloadskribilo-32136d000be5c570133c48c3650d5d7b51efa2fc.tar.gz
skribilo-32136d000be5c570133c48c3650d5d7b51efa2fc.tar.lz
skribilo-32136d000be5c570133c48c3650d5d7b51efa2fc.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: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-24
-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.