diff options
author | Ludovic Court`es | 2007-03-16 17:11:30 +0000 |
---|---|---|
committer | Ludovic Court`es | 2007-03-16 17:11:30 +0000 |
commit | 69ec14620bc8b2780fca8ec1c3f4cde5204d6f84 (patch) | |
tree | f1a44d1cb10cd576774c34cc4294e0708652066c /src/guile | |
parent | 20e07303a9da769e56feb90c252ee0a66369b52d (diff) | |
parent | 8fe4d235248bc54d4cf6c204d0267276647e0bd9 (diff) | |
download | skribilo-69ec14620bc8b2780fca8ec1c3f4cde5204d6f84.tar.gz skribilo-69ec14620bc8b2780fca8ec1c3f4cde5204d6f84.tar.lz skribilo-69ec14620bc8b2780fca8ec1c3f4cde5204d6f84.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: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-67
Diffstat (limited to 'src/guile')
-rw-r--r-- | src/guile/skribilo/package/eq.scm | 29 | ||||
-rw-r--r-- | src/guile/skribilo/package/eq/lout.scm | 25 |
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 |