diff options
author | Ludovic Courtes | 2006-12-03 21:52:02 +0000 |
---|---|---|
committer | Ludovic Courtes | 2006-12-03 21:52:02 +0000 |
commit | 80a7bbc7174962aaeca389b1b1592dc74297d50f (patch) | |
tree | 2f2efd6abf6193a2c60c784e9eac88ea7667ba48 /src/guile | |
parent | a165a2604af8b9d222488a29eb5165c791fa2c73 (diff) | |
download | skribilo-80a7bbc7174962aaeca389b1b1592dc74297d50f.tar.gz skribilo-80a7bbc7174962aaeca389b1b1592dc74297d50f.tar.lz skribilo-80a7bbc7174962aaeca389b1b1592dc74297d50f.zip |
eq: Added support for `:mul-style'.
* src/guile/skribilo/package/eq.scm (eq)[:mul-style]: New option.
(eq*)[mul-style]: New option.
* src/guile/skribilo/package/eq/lout.scm (eq)[options]: Added
`:mul-style'.
(mul-style->lout): New.
(eq:*): Support `:mul-style'.
git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-30
Diffstat (limited to 'src/guile')
-rw-r--r-- | src/guile/skribilo/package/eq.scm | 21 | ||||
-rw-r--r-- | src/guile/skribilo/package/eq/lout.scm | 24 |
2 files changed, 38 insertions, 7 deletions
diff --git a/src/guile/skribilo/package/eq.scm b/src/guile/skribilo/package/eq.scm index 76bbf6c..e783c89 100644 --- a/src/guile/skribilo/package/eq.scm +++ b/src/guile/skribilo/package/eq.scm @@ -190,20 +190,22 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g., (markup 'eq-display) (ident (or ident (symbol->string (gensym "eq-display")))) (class class) - (options (the-options opts :ident :class :div-style)) + (options (the-options opts :ident :class)) (body (the-body opts)))) (define-markup (eq :rest opts :key (ident #f) (class "eq") (inline? #f) (align-with #f) - (renderer #f) (div-style 'over)) + (renderer #f) (div-style 'over) + (mul-style 'space)) (new container (markup 'eq) (ident (or ident (symbol->string (gensym "eq")))) (class class) (options `((:div-style ,div-style) (:align-with ,align-with) + (:mul-style ,mul-style) ,@(the-options opts :ident :class - :div-style :align-with))) + :div-style :mul-style :align-with))) (body (let loop ((body (the-body opts)) (result '())) (if (null? body) @@ -224,10 +226,19 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g., (ident (or ident (symbol->string (gensym "eq:/")))) (class #f) (options `((:div-style ,div-style) - ,@(the-options opts :ident :class :div-style))) + ,@(the-options opts :ident :div-style))) + (body (the-body opts)))) + +(define-markup (eq:* :rest opts :key (ident #f) (mul-style #f)) + ;; If no `:mul-style' is specified here, obey the top-level one. + (new markup + (markup 'eq:*) + (ident (or ident (symbol->string (gensym "eq:*")))) + (class #f) + (options `((:mul-style ,mul-style) + ,@(the-options opts :ident :mul-style))) (body (the-body opts)))) -(define-simple-markup eq:*) (define-simple-markup eq:+) (define-simple-markup eq:-) diff --git a/src/guile/skribilo/package/eq/lout.scm b/src/guile/skribilo/package/eq/lout.scm index cc4b3bf..c8ea50a 100644 --- a/src/guile/skribilo/package/eq/lout.scm +++ b/src/guile/skribilo/package/eq/lout.scm @@ -56,7 +56,7 @@ :after "\n@EndAlignedDisplays\n") (markup-writer 'eq (find-engine 'lout) - :options '(:inline? :align-with :div-style) + :options '(:inline? :align-with :div-style :mul-style) :before (lambda (node engine) (let* ((parent (ast-parent node)) (displayed? (is-markup? parent 'eq-display))) @@ -87,6 +87,16 @@ (else (error "unsupported div style" style)))) +(define (mul-style->lout style) + (case style + ((space) "") + ((cross) "times") + ((asterisk) "*") + ((dot) "cdot") + (else + (error "unsupported mul style" style)))) + + (define-macro (simple-lout-markup-writer sym . args) (let* ((lout-name (if (null? args) (symbol->string sym) @@ -151,8 +161,18 @@ (simple-lout-markup-writer +) -(simple-lout-markup-writer * "times") (simple-lout-markup-writer - "-") + +(simple-lout-markup-writer * + (lambda (n e) + ;; Obey either the per-node `:mul-style' or the + ;; top-level one. + (or (markup-option n :mul-style) + (let* ((eq (ast-parent n)) + (mul-style + (markup-option eq :mul-style))) + (mul-style->lout mul-style))))) + (simple-lout-markup-writer / (lambda (n e) ;; Obey either the per-node `:div-style' or the |