diff options
Diffstat (limited to 'src/guile/skribilo/package/eq.scm')
-rw-r--r-- | src/guile/skribilo/package/eq.scm | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/guile/skribilo/package/eq.scm b/src/guile/skribilo/package/eq.scm index 76bbf6c..cadc1ba 100644 --- a/src/guile/skribilo/package/eq.scm +++ b/src/guile/skribilo/package/eq.scm @@ -19,7 +19,7 @@ ;;; USA. (define-module (skribilo package eq) - :autoload (skribilo ast) (markup?) + :autoload (skribilo ast) (markup? find-up) :autoload (skribilo output) (output) :use-module (skribilo writer) :use-module (skribilo engine) @@ -117,6 +117,18 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g., (string-length str)))) #f)) +(define-public (inline-equation? m) + "Return @code{#t} if @var{m} is an equation that is to be displayed inline." + (and (is-markup? m 'eq) + (let ((i (markup-option m :inline?))) + (case i + ((auto) + (not (find-up (lambda (n) + (is-markup? n 'eq-display)) + m))) + ((#t) #t) + (else #f))))) + ;;; ;;; Operator precedence. @@ -190,20 +202,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)) + (inline? 'auto) (align-with #f) + (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 +238,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:-) |