aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog201
-rw-r--r--doc/user/eq.skb11
-rw-r--r--src/guile/skribilo/package/eq.scm37
-rw-r--r--src/guile/skribilo/package/eq/lout.scm63
4 files changed, 282 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index f0cafb4..52f6d53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,207 @@
# arch-tag: automatic-ChangeLog--lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2
#
+2006-12-03 20:02:17 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-91
+
+ Summary:
+ doc: Updated the `eq' markup documentation.
+ Revision:
+ skribilo--devel--1.2--patch-91
+
+ * doc/user/eq.skb: Updated documentation of `eq': the `inline?'
+ parameter and the `:mul-style' parameter.
+
+ modified files:
+ ChangeLog doc/user/eq.skb
+
+
+2006-12-03 19:59:46 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-90
+
+ Summary:
+ eq: Support automatic detection of inlining.
+ Revision:
+ skribilo--devel--1.2--patch-90
+
+ * src/guile/skribilo/package/eq.scm (inline-equation?): New.
+ (eq)[inline?]: Default to `auto'.
+
+ * src/guile/skribilo/package/eq/lout.scm (eq): Use `inline-equation?'.
+
+ modified files:
+ ChangeLog src/guile/skribilo/package/eq.scm
+ src/guile/skribilo/package/eq/lout.scm
+
+
+2006-12-03 19:31:45 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-89
+
+ Summary:
+ eq/lout: Fixed binomial coefficient.
+ Revision:
+ skribilo--devel--1.2--patch-89
+
+ * src/guile/skribilo/package/eq/lout.scm (eq:combinations): Fixed
+ spacing, use `lpar' instead of `blpar' (according to "The TeXbook"),
+ changed order of OF and AMONG.
+
+ modified files:
+ ChangeLog src/guile/skribilo/package/eq/lout.scm
+
+
+2006-12-03 19:21:19 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-88
+
+ Summary:
+ eq: Added support for `:mul-style'.
+ Revision:
+ skribilo--devel--1.2--patch-88
+
+ * 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'.
+
+ modified files:
+ ChangeLog src/guile/skribilo/package/eq.scm
+ src/guile/skribilo/package/eq/lout.scm
+
+
+2006-12-03 19:00:42 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-87
+
+ Summary:
+ eq/lout: Improved typesetting of parentheses.
+ Revision:
+ skribilo--devel--1.2--patch-87
+
+ * src/guile/skribilo/package/eq/lout.scm (%left-paren): New.
+ (%right-paren): New.
+ (simple-lout-markup-writer): Use them.
+ (binary-lout-markup-writer): Likewise.
+ (eq:apply): Likewise.
+ (eq:limit): Likewise.
+
+ modified files:
+ ChangeLog src/guile/skribilo/package/eq/lout.scm
+
+
+2006-12-03 17:35:08 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-86
+
+ Summary:
+ eq/lout: Fixed `limit'.
+ Revision:
+ skribilo--devel--1.2--patch-86
+
+ * src/guile/skribilo/package/eq/lout.scm (eq:limit): Use `from' instead
+ of `on'.
+
+ modified files:
+ ChangeLog src/guile/skribilo/package/eq/lout.scm
+
+
+2006-12-02 10:56:17 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-85
+
+ Summary:
+ Merge from skribilo@sv.gnu.org--2006/skribilo--devo--1.2
+ Revision:
+ skribilo--devel--1.2--patch-85
+
+ Patches applied:
+
+ * lcourtes@laas.fr--2005-libre/skribilo--devo--1.2 (patch 80-85)
+ * skribilo@sv.gnu.org--2006/skribilo--devo--1.2 (patch 22-27)
+
+ - eq: Added the `:div-style' option.
+ - doc: Documented `eq' and the `:div-style' option.
+ - eq: Added `limit' and `combinations'.
+ - eq: Properly handle operator precedence.
+ - eq: Added `eq-display' and the `:align-with' option for `eq'.
+ - doc: Augmented the `eq' doc, documented `eq-display'.
+
+ new files:
+ doc/user/src/.arch-ids/eq3.skb.id doc/user/src/eq3.skb
+
+ modified files:
+ ChangeLog doc/user/char.skb doc/user/eq.skb
+ src/guile/skribilo/package/eq.scm
+ src/guile/skribilo/package/eq/lout.scm
+
+ new patches:
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-80
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-81
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-82
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-83
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-84
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-85
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-22
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-23
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-24
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-25
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-26
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-27
+
+
+2006-11-25 17:47:29 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-84
+
+ Summary:
+ Merge from skribilo@sv.gnu.org--2006/skribilo--devo--1.2
+ Revision:
+ skribilo--devel--1.2--patch-84
+
+ Patches applied:
+
+ * lcourtes@laas.fr--2005-libre/skribilo--devo--1.2 (patch 72-79)
+
+ - Merge from skribilo@sv.gnu.org--2006
+ - Lout engine: Better cover sheet for `doc' documents.
+ - outline reader: Support keywords.
+ - lout: bib-ref+: Gracefully handle `unref' objects.
+ - Introduced `markup-number-string'.
+ - `base' package: Added `numref'.
+ - doc: Documented `numref'.
+ - Cleaned up `(skribilo biblio)' a bit.
+
+ * skribilo@sv.gnu.org--2006/skribilo--devo--1.2 (patch 13-21)
+
+ - Added the `(skribilo biblio template)' module.
+ - Lout engine: Make URLs breakable; make bibliography defaults sane.
+ - Lout engine: Better cover sheet for `doc' documents.
+ - outline reader: Support keywords.
+ - lout: bib-ref+: Gracefully handle `unref' objects.
+ - Introduced `markup-number-string'.
+ - `base' package: Added `numref'.
+ - doc: Documented `numref'.
+ - Cleaned up `(skribilo biblio)' a bit.
+
+ modified files:
+ ChangeLog doc/user/bib.skb doc/user/links.skb
+ doc/user/src/links1.skb src/guile/skribilo/ast.scm
+ src/guile/skribilo/biblio.scm
+ src/guile/skribilo/engine/lout.scm
+ src/guile/skribilo/package/base.scm
+ src/guile/skribilo/reader/outline.scm
+ src/guile/skribilo/utils/compat.scm
+
+ new patches:
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-72
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-73
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-74
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-75
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-76
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-77
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-78
+ lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-79
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-13
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-14
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-15
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-16
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-17
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-18
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-19
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-20
+ skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-21
+
+
2006-11-11 23:02:57 GMT Ludovic Courtes <ludovic.courtes@laas.fr> patch-83
Summary:
diff --git a/doc/user/eq.skb b/doc/user/eq.skb
index 1ef0208..fb8c3ef 100644
--- a/doc/user/eq.skb
+++ b/doc/user/eq.skb
@@ -90,13 +90,18 @@ particular operator. ]
are summarized here:])
(doc-markup 'eq
- `((:inline? [A boolean indicating whether the equation
-is to appear "inline", i.e., within a paragraph. If the engine supports
-it, it may adjust various parameters such as in-equation spacing
+ `((:inline? [If ,(code [auto]), Skribilo will
+automatically determine whether the equation is to be "in-line".
+Otherwise, it should be a boolean indicating whether the equation is to
+appear "in-line", i.e., within a paragraph. If the engine supports it,
+it may adjust various parameters such as in-equation spacing
accordingly.])
(:renderer [The engine that should be used to render
the equation. This allows, for instance, to use the Lout engine to
render equations in HTML.])
+ (:mul-style [A symbol denoting the default style for
+multiplications. This should be one of ,(code [space]), ,(code
+[cross]), ,(code [asterisk]) or ,(code [dot]).])
(:div-style [A symbol denoting the default style for
divisions. This should be one of ,(code [over]), ,(code [fraction]),
,(code [div]) and ,(code [slash]). Per-,(code [eq:/]) ,(code
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:-)
diff --git a/src/guile/skribilo/package/eq/lout.scm b/src/guile/skribilo/package/eq/lout.scm
index b1ff7ae..e08e6d1 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)))
@@ -64,7 +64,7 @@
(if (and displayed? (not (*embedded-renderer*)))
"\n@IAD " ""))))
:action (lambda (node engine)
- (display (if (markup-option node :inline?)
+ (display (if (inline-equation? node)
"@E { "
"@Eq { "))
(let ((eq (markup-body node)))
@@ -73,6 +73,11 @@
:after " } }")
+;; Scaled parenthesis. We could use `pmatrix' here but it precludes
+;; line-breaking within equations.
+(define %left-paren "{ Base @Font @VScale \"(\" }")
+(define %right-paren "{ Base @Font @VScale \")\" }")
+
(define (div-style->lout style)
(case style
((over) "over")
@@ -82,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)
@@ -91,13 +106,11 @@
(cadr args)))
(precedence (operator-precedence sym))
- ;; Note: We could use `pmatrix' here but it precludes line-breaking
- ;; within equations.
(open-par (if parentheses?
- `(if need-paren? "{ @VScale ( }" "")
+ `(if need-paren? %left-paren "")
""))
(close-par (if parentheses?
- `(if need-paren? "{ @VScale ) }" "")
+ `(if need-paren? %right-paren "")
"")))
`(markup-writer ',(symbol-append 'eq: sym) (find-engine 'lout)
@@ -148,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
@@ -175,9 +198,9 @@
(second (cadr body))
(parentheses? (equation-markup? first)))
(display " { { ")
- (if parentheses? (display "("))
+ (if parentheses? (display %left-paren))
(output first engine)
- (if parentheses? (display ")"))
+ (if parentheses? (display %right-paren))
(display ,(string-append " } " lout-name " { "))
(output second engine)
(display " } } "))
@@ -185,15 +208,15 @@
"wrong number of arguments"
body))))))
-(binary-lout-markup-writer expt "sup")
-(binary-lout-markup-writer in "element")
+(binary-lout-markup-writer expt "sup")
+(binary-lout-markup-writer in "element")
(binary-lout-markup-writer notin "notelement")
(markup-writer 'eq:apply (find-engine 'lout)
:action (lambda (node engine)
(let ((func (car (markup-body node))))
(output func engine)
- (display "(")
+ (display %left-paren)
(let loop ((operands (cdr (markup-body node))))
(if (null? operands)
#t
@@ -202,7 +225,7 @@
(if (not (null? (cdr operands)))
(display ", "))
(loop (cdr operands)))))
- (display ")"))))
+ (display %right-paren))))
(markup-writer 'eq:limit (find-engine 'lout)
@@ -210,24 +233,24 @@
(let ((body (markup-body node))
(var (markup-option node :var))
(limit (markup-option node :limit)))
- (display "{ lim on { ")
+ (display "{ lim from { ")
(output var engine)
(display " --> ")
(output limit engine)
- (display " } } (")
+ (display (string-append " } } @VContract { " %left-paren))
(output body engine)
- (display ") "))))
+ (display (string-append %right-paren " } ")))))
(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 " ` { matrix atleft { lpar } atright { rpar } { ")
(display "row col { ")
- (output among engine)
- (display " } row col { ")
(output of engine)
- (display " } } }\n"))))
+ (display " } row col { ")
+ (output among engine)
+ (display " } } } `\n"))))
;;;