From 32136d000be5c570133c48c3650d5d7b51efa2fc Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Sat, 2 Dec 2006 10:42:56 +0000 Subject: 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 --- src/guile/skribilo/package/eq.scm | 40 +++++++++++++++++++++++++++++++++- src/guile/skribilo/package/eq/lout.scm | 24 ++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) (limited to 'src') 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. -- cgit v1.2.3