summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Court`es2007-03-16 12:43:45 +0000
committerLudovic Court`es2007-03-16 12:43:45 +0000
commit8fe4d235248bc54d4cf6c204d0267276647e0bd9 (patch)
treeb4c989f3cf7288ab84c4eb0bb600e7debcda669d
parentb594657ce02d1d79a1eec77178637436d5703462 (diff)
downloadskribilo-8fe4d235248bc54d4cf6c204d0267276647e0bd9.tar.gz
skribilo-8fe4d235248bc54d4cf6c204d0267276647e0bd9.tar.lz
skribilo-8fe4d235248bc54d4cf6c204d0267276647e0bd9.zip
`eq' package: Added `eq:set'.
* src/guile/skribilo/package/eq.scm: Use `(srfi srfi-1)'. (%operators): Added `set'. (eq:set): New. New writer. * src/guile/skribilo/package/eq/lout.scm: Use `srfi-1'. (eq:set): New writer. git-archimport-id: lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-26
-rw-r--r--src/guile/skribilo/package/eq.scm29
-rw-r--r--src/guile/skribilo/package/eq/lout.scm25
2 files changed, 51 insertions, 3 deletions
diff --git a/src/guile/skribilo/package/eq.scm b/src/guile/skribilo/package/eq.scm
index cadc1ba..af2c906 100644
--- a/src/guile/skribilo/package/eq.scm
+++ b/src/guile/skribilo/package/eq.scm
@@ -1,6 +1,6 @@
;;; eq.scm -- An equation formatting package.
;;;
-;;; Copyright 2005, 2006 Ludovic Courtès <ludovic.courtes@laas.fr>
+;;; Copyright 2005, 2006, 2007 Ludovic Courtès <ludovic.courtes@laas.fr>
;;;
;;;
;;; This program is free software; you can redistribute it and/or modify
@@ -30,6 +30,7 @@
:autoload (skribilo package base) (it symbol sub sup)
:autoload (skribilo engine lout) (lout-illustration)
+ :use-module (srfi srfi-1)
:use-module (srfi srfi-39)
:use-module (ice-9 optargs))
@@ -61,7 +62,7 @@
(define %operators
'(/ * + - = != ~= < > <= >= sqrt expt sum product script
- in notin apply limit combinations))
+ in notin apply limit combinations set))
(define %symbols
;; A set of symbols that are automatically recognized within an `eq' quoted
@@ -330,6 +331,13 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g.,
,@(the-options opts :ident)))
(body (the-body opts))))
+(define-markup (eq:set :rest opts :key (ident #f))
+ (new markup
+ (markup 'eq:set)
+ (ident (or ident (symbol->string (gensym "eq:set"))))
+ (options '())
+ (body (the-body opts))))
+
;;;
;;; Text-based rendering.
@@ -533,6 +541,23 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g.,
(output among engine)
(display ")"))))
+(markup-writer 'eq:set (find-engine 'base)
+ ;; Take the elements of the set and enclose them into braces.
+ :action (lambda (node engine)
+ (define (printable elem)
+ (if (eq? elem '...)
+ (symbol "ellipsis")
+ elem))
+
+ (output "{ " engine)
+ (pair-for-each (lambda (pair)
+ (let ((elem (printable (car pair))))
+ (output elem engine)
+ (if (not (null? (cdr pair)))
+ (output ", " engine))))
+ (markup-body node))
+ (output " }" engine)))
+
;;;
diff --git a/src/guile/skribilo/package/eq/lout.scm b/src/guile/skribilo/package/eq/lout.scm
index 21e8f92..5633ae4 100644
--- a/src/guile/skribilo/package/eq/lout.scm
+++ b/src/guile/skribilo/package/eq/lout.scm
@@ -1,6 +1,6 @@
;;; lout.scm -- Lout implementation of the `eq' package.
;;;
-;;; Copyright 2005, 2006 Ludovic Courtès <ludovic.courtes@laas.fr>
+;;; Copyright 2005, 2006, 2007 Ludovic Courtès <ludovic.courtes@laas.fr>
;;;
;;;
;;; This program is free software; you can redistribute it and/or modify
@@ -27,6 +27,7 @@
:use-module (skribilo lib)
:use-module (skribilo utils syntax)
:use-module (skribilo utils keywords) ;; `the-options', etc.
+ :use-module (srfi srfi-1)
:use-module (ice-9 optargs))
(fluid-set! current-reader %skribilo-module-reader)
@@ -293,5 +294,27 @@
(display " } ")))
(display " } "))))
+
+;;;
+;;; Sets.
+;;;
+
+(markup-writer 'eq:set (find-engine 'lout)
+ ;; Take the elements of the set and enclose them into braces.
+ :action (lambda (node engine)
+ (define (printable elem)
+ (if (eq? elem '...)
+ (symbol "ellipsis")
+ elem))
+
+ (display " brmatrix { ")
+ (pair-for-each (lambda (pair)
+ (let ((elem (printable (car pair))))
+ (output elem engine)
+ (if (not (null? (cdr pair)))
+ (output ", " engine))))
+ (markup-body node))
+ (display " } ")))
+
;;; arch-tag: 2a1410e5-977e-4600-b781-3d57f4409b35