summary refs log tree commit diff
path: root/src/guile
diff options
context:
space:
mode:
authorLudovic Courtes2006-12-03 21:51:27 +0000
committerLudovic Courtes2006-12-03 21:51:27 +0000
commita165a2604af8b9d222488a29eb5165c791fa2c73 (patch)
tree405dbed4f77f30e686ce78deaa79ad014dff65c6 /src/guile
parentfd94a38600be0fa9103f598edabde9307aeea4b2 (diff)
downloadskribilo-a165a2604af8b9d222488a29eb5165c791fa2c73.tar.gz
skribilo-a165a2604af8b9d222488a29eb5165c791fa2c73.tar.lz
skribilo-a165a2604af8b9d222488a29eb5165c791fa2c73.zip
eq/lout: Improved typesetting of parentheses.
* 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.

git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-29
Diffstat (limited to 'src/guile')
-rw-r--r--src/guile/skribilo/package/eq/lout.scm27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/guile/skribilo/package/eq/lout.scm b/src/guile/skribilo/package/eq/lout.scm
index 16d4513..cc4b3bf 100644
--- a/src/guile/skribilo/package/eq/lout.scm
+++ b/src/guile/skribilo/package/eq/lout.scm
@@ -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")
@@ -91,13 +96,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)
@@ -175,9 +178,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 +188,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 +205,7 @@
 		       (if (not (null? (cdr operands)))
 			   (display ", "))
 		       (loop (cdr operands)))))
-	       (display ")"))))
+	       (display %right-paren))))
 
 
 (markup-writer 'eq:limit (find-engine 'lout)
@@ -214,9 +217,9 @@
                (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)