summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.