From b0e202992a38753888465fa8fb1331ac31f838ec Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Sat, 25 Nov 2006 17:41:44 +0000 Subject: doc: Documented `numref'. * doc/user/links.skb (Reference): Added identifier `refs'. [ref](page): Explain that this option is hardcopy-specific. [numref]: New. * doc/user/src/links1.skb: Show `numref' usage. git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-20 --- doc/user/links.skb | 24 +++++++++++++++++++----- doc/user/src/links1.skb | 4 ++++ 2 files changed, 23 insertions(+), 5 deletions(-) (limited to 'doc/user') diff --git a/doc/user/links.skb b/doc/user/links.skb index ae7301c..c6e37a0 100644 --- a/doc/user/links.skb +++ b/doc/user/links.skb @@ -71,9 +71,9 @@ automatically sets a mark whose value is the legend of the figure.])) ;*---------------------------------------------------------------------*/ ;* ref ... @label ref@ */ ;*---------------------------------------------------------------------*/ -(section :title "Reference" +(section :title "Reference" :ident "refs" -(p [Skribe proposes only one single function for all the references. +(p [Skribilo proposes a single function that can be used for most references. This same ,(code "ref") function is used for introducing references to section, to bibliographic entries, to source code line number, etc.]) @@ -92,7 +92,8 @@ section, to bibliographic entries, to source code line number, etc.]) (:section [The title of a ,(markup-ref "section").]) (:subsection [The title of a ,(markup-ref "subsection").]) (:subsubsection [The title of a ,(markup-ref "subsubsection").]) - (:page [A boolean enabling/disabling page reference.]) + (:page [A boolean enabling/disabling page reference (for + hard copies as produced by the Lout and LaTeX engines).]) (:bib ,[A name or a list of names of ,(ref :chapter "Bibliographies" :text "bibliographic") entry.]) (:bib-table ,[The @@ -108,8 +109,21 @@ section, to bibliographic entries, to source code line number, etc.]) a ,(tt "mark") located in the Skribe document described by the ,(var "file") ,(sc "sui").])) :force-args '(:url :bib :line :skribe) - :see-also '(index)) - + :see-also '(index numref)) + +(p [Sometimes, it is useful to produce phrases that refer a section by +its number, as in ``See Section 2.3''. This is especially useful on +printed documents, as produced by the Lout and LaTeX engines. The +,(code "numref") markup is provided to that end:]) + +(doc-markup 'numref + `((:text [Text preceding the reference number.]) + (:ident [The identifier of the node (a chapter, section, + subsection, etc.) being referenced.]) + (:page [A boolean enabling/disabling page reference (for + hard copies as produced by the Lout and LaTeX engines).]) + (:separator [The separator between numbers.])) + :see-also '(ref)) (example-produce (example :legend "Some references" (prgm :file "src/links1.skb")) diff --git a/doc/user/src/links1.skb b/doc/user/src/links1.skb index e0b393b..bfe6f86 100644 --- a/doc/user/src/links1.skb +++ b/doc/user/src/links1.skb @@ -10,6 +10,10 @@ That other one points to a well known ,(ref :url "http://slashdot.org/" :text "url"). The same without ,(code ":text"): ,(ref :url "http://slashdot.org/"). +,(linebreak) +And one can also refer to sections by number, as in ``see ,(numref :text +[Wonderful Section] :ident "refs")''. + ,(linebreak) With more complex tricks that are explained in Section ,(ref :section "Resolve"), it is also possible use, for the text of the -- cgit v1.2.3 From 80b757fc4bf93f59edde426b9fca4dcca15509c3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Sat, 25 Nov 2006 17:42:18 +0000 Subject: Cleaned up `(skribilo biblio)' a bit. * doc/user/bib.skb: Replaced `default-bib-table' with `*bib-table*'. * src/guile/skribilo/biblio.scm: Clean up. (skribe-open-bib-file): Renamed to `open-bib-file'. * src/guile/skribilo/package/base.scm: Use `*bib-table*' instead of `default-bib-table'. * src/guile/skribilo/utils/compat.scm: Autoload `biblio'. (default-bib-table): New. (skribe-open-bib-file): New. git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-21 --- doc/user/bib.skb | 20 ++++--- src/guile/skribilo/biblio.scm | 103 +++++++++++++----------------------- src/guile/skribilo/package/base.scm | 8 +-- src/guile/skribilo/utils/compat.scm | 13 +++++ 4 files changed, 67 insertions(+), 77 deletions(-) (limited to 'doc/user') diff --git a/doc/user/bib.skb b/doc/user/bib.skb index 5b26417..e7b5b77 100644 --- a/doc/user/bib.skb +++ b/doc/user/bib.skb @@ -52,32 +52,36 @@ tables.]) (p [The predicate ,(code "bib-table?") returns ,(code "#t") if and only if its argument is a bibliography table as returned by -,(markup-ref "make-bib-table") or ,(markup-ref "default-bib-table"). Otherwise +,(markup-ref "make-bib-table") or ,(markup-ref "*bib-table*"). Otherwise ,(code "bib-table?") returns ,(code "#f").]) (doc-markup 'bib-table? '((obj [The value to be tested])) - :see-also '(make-bib-table default-bib-table bibliography the-bibliography) + :see-also '(make-bib-table *bib-table* bibliography the-bibliography) :force-engines *api-engines* :common-args '() :source #f ;;"skribilo/biblio.scm" :def '(define-markup (bib-table? obj) ...)) - (p [The function ,(code "default-bib-table") returns a global, pre-existing + (p [The function ,(code "*bib-table*") returns a global, pre-existing bibliography-table:]) - (doc-markup 'default-bib-table + (doc-markup '*bib-table* '() :see-also '(bib-table? make-bib-table bibliography the-bibliography) :force-engines *api-engines* :common-args '() :source #f - :def '(define-markup (default-bib-table) ...)) + :def '(define-markup (*bib-table*) ...)) + (p [Technically, ,(code "*bib-table*") is actually an ,(ref :text +[SRFI-39] :url "http://srfi.schemers.org/srfi-39/srfi-39.html") +parameter object, so it can be queried and modified like any other +parameter object.]) (p [The function ,(code "make-bib-table") constructs a new bibliography-table:]) (doc-markup 'make-bib-table '((ident [The name of the bibliography table.])) - :see-also '(bib-table? default-bib-table bibliography the-bibliography) + :see-also '(bib-table? *bib-table* bibliography the-bibliography) :force-engines *api-engines* :common-args '() :source #f @@ -109,7 +113,7 @@ the ,(code "bibliography") Skribe function call before the call to the :text "bibliograph path")). Otherwise, it is a list described by the ,(ref :subsection "Bibliography syntax" :text "syntax") below.])) - :see-also '(bib-table? make-bib-table default-bib-table the-bibliography) + :see-also '(bib-table? make-bib-table *bib-table* the-bibliography) :force-engines *api-engines* :common-args '()) @@ -161,7 +165,7 @@ Here is an example of a simple Skribe database.]) filtered in by ,(param :pred). The value ,(code "full") tells Skribe to count all entries, event those filtered out by ,(param :pred).])) - :see-also '(bib-table? make-bib-table default-bib-table bibliography) + :see-also '(bib-table? make-bib-table *bib-table* bibliography) :force-engines *api-engines* :common-args '()) diff --git a/src/guile/skribilo/biblio.scm b/src/guile/skribilo/biblio.scm index 1fb4b78..55f2ea9 100644 --- a/src/guile/skribilo/biblio.scm +++ b/src/guile/skribilo/biblio.scm @@ -1,5 +1,6 @@ ;;; biblio.scm -- Bibliography functions. ;;; +;;; Copyright 2001, 2002, 2003, 2004 Manuel Serrano ;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI ;;; Copyright 2005, 2006 Ludovic Courtès ;;; @@ -24,9 +25,10 @@ :use-module (skribilo utils strings) :use-module (skribilo utils syntax) ;; `when', `unless' + :use-module (srfi srfi-1) :autoload (srfi srfi-34) (raise) :use-module (srfi srfi-35) - :use-module (srfi srfi-1) + :use-module (srfi srfi-39) :autoload (skribilo condition) (&file-search-error) :autoload (skribilo reader) (%default-reader) @@ -36,9 +38,9 @@ :use-module (ice-9 optargs) :use-module (oop goops) - :export (bib-table? make-bib-table default-bib-table + :export (bib-table? make-bib-table *bib-table* bib-add! bib-duplicate bib-for-each bib-map - skribe-open-bib-file parse-bib + open-bib-file parse-bib bib-load! resolve-bib resolve-the-bib make-bib-entry @@ -52,27 +54,15 @@ ;;; Provides the bibliography data type and basic bibliography handling, ;;; including simple procedures to sort bibliography entries. ;;; -;;; FIXME: This module need cleanup! -;;; ;;; Code: (fluid-set! current-reader %skribilo-module-reader) - -;; FIXME: Should be a fluid? -(define *bib-table* #f) - -;; Forward declarations -(define skribe-open-bib-file #f) -(define parse-bib #f) - -;;; ====================================================================== ;;; -;;; Utilities +;;; Accessors. ;;; -;;; ====================================================================== (define (make-bib-table ident) (make-hash-table)) @@ -80,10 +70,9 @@ (define (bib-table? obj) (hash-table? obj)) -(define (default-bib-table) - (unless *bib-table* - (set! *bib-table* (make-bib-table "default-bib-table"))) - *bib-table*) +;; The current bib table. +(define *bib-table* + (make-parameter (make-bib-table "default-bib-table"))) (define (%bib-error who entry) (let ((msg "bibliography syntax error on entry")) @@ -91,22 +80,34 @@ (skribe-line-error (%epair-file entry) (%epair-line entry) who msg entry) (skribe-error who msg entry)))) -(define* (bib-for-each proc :optional (table (default-bib-table))) +(define (bib-add! table . entries) + (if (not (bib-table? table)) + (skribe-error 'bib-add! "Illegal bibliography table" table) + (for-each (lambda (entry) + (cond + ((and (list? entry) (> (length entry) 2)) + (let* ((kind (car entry)) + (key (format #f "~A" (cadr entry))) + (fields (cddr entry)) + (old (hash-ref table key))) + (if old + (bib-duplicate key #f old) + (hash-set! table key + (make-bib-entry kind key fields #f))))) + (else + (%bib-error 'bib-add! entry)))) + entries))) + +(define* (bib-for-each proc :optional (table (*bib-table*))) (hash-for-each (lambda (ident entry) (proc ident entry)) table)) -(define* (bib-map proc :optional (table (default-bib-table))) +(define* (bib-map proc :optional (table (*bib-table*))) (hash-map->list (lambda (ident entry) (proc ident entry)) table)) - -;;; ====================================================================== -;;; -;;; BIB-DUPLICATE -;;; -;;; ====================================================================== (define (bib-duplicate ident from old) (let ((ofrom (markup-option old 'from))) (skribe-warning 2 @@ -120,11 +121,11 @@ " ignoring redefinition.")))) -;;; ====================================================================== + ;;; -;;; PARSE-BIB +;;; Parsing. ;;; -;;; ====================================================================== + (define (parse-bib table port) (let ((read %default-reader)) ;; FIXME: We should use a fluid (if (not (bib-table? table)) @@ -146,43 +147,15 @@ (else (%bib-error 'bib-parse entry))))))))) - -;;; ====================================================================== -;;; -;;; BIB-ADD! -;;; -;;; ====================================================================== -(define (bib-add! table . entries) - (if (not (bib-table? table)) - (skribe-error 'bib-add! "Illegal bibliography table" table) - (for-each (lambda (entry) - (cond - ((and (list? entry) (> (length entry) 2)) - (let* ((kind (car entry)) - (key (format #f "~A" (cadr entry))) - (fields (cddr entry)) - (old (hash-ref table key))) - (if old - (bib-duplicate key #f old) - (hash-set! table key - (make-bib-entry kind key fields #f))))) - (else - (%bib-error 'bib-add! entry)))) - entries))) - - -;;; ====================================================================== -;;; -;;; SKRIBE-OPEN-BIB-FILE -;;; -;;; ====================================================================== -;; FIXME: Factoriser -(define (skribe-open-bib-file file command) +(define* (open-bib-file file :optional (command #f)) (let ((path (search-path (*bib-path*) file))) (if (string? path) (begin (when (> (*verbose*) 0) - (format (current-error-port) " [loading bibliography: ~S]\n" path)) + (format (current-error-port) + " [loading bibliography: ~S]\n" path)) + ;; FIXME: The following `open-input-file' won't work with actual + ;; commands. We need to use `(ice-9 popen)'. (open-input-file (if (string? command) (string-append "| " (format #f command path)) @@ -209,7 +182,7 @@ (if (not (bib-table? table)) (skribe-error 'bib-load "Illegal bibliography table" table) ;; read the file - (let ((p (skribe-open-bib-file filename command))) + (let ((p (open-bib-file filename command))) (if (not (input-port? p)) (skribe-error 'bib-load "Can't open data base" filename) (unwind-protect diff --git a/src/guile/skribilo/package/base.scm b/src/guile/skribilo/package/base.scm index 4c9e84c..01e8667 100644 --- a/src/guile/skribilo/package/base.scm +++ b/src/guile/skribilo/package/base.scm @@ -33,7 +33,7 @@ :autoload (skribilo engine) (engine?) ;; optional ``sub-packages'' - :autoload (skribilo biblio) (default-bib-table resolve-bib + :autoload (skribilo biblio) (*bib-table* resolve-bib bib-load! bib-add!) :autoload (skribilo color) (skribe-use-color!) :autoload (skribilo source) (language? source-read-lines source-fontify) @@ -1015,7 +1015,7 @@ (subsection #f) (subsubsection #f) (bib #f) - (bib-table (default-bib-table)) + (bib-table (*bib-table*)) (url #f) (figure #f) (mark #f) @@ -1245,7 +1245,7 @@ ;*---------------------------------------------------------------------*/ (define-markup (bibliography #!rest files #!key - (command #f) (bib-table (default-bib-table))) + (command #f) (bib-table (*bib-table*))) (for-each (lambda (f) (cond ((string? f) @@ -1267,7 +1267,7 @@ (define-markup (the-bibliography #!rest opts #!key pred - (bib-table (default-bib-table)) + (bib-table (*bib-table*)) (sort bib-sort/authors) (count 'partial)) (if (not (memq count '(partial full))) diff --git a/src/guile/skribilo/utils/compat.scm b/src/guile/skribilo/utils/compat.scm index 118f294..4905cef 100644 --- a/src/guile/skribilo/utils/compat.scm +++ b/src/guile/skribilo/utils/compat.scm @@ -35,6 +35,7 @@ :autoload (skribilo lib) (type-name) :autoload (skribilo resolve) (*document-being-resolved*) :autoload (skribilo output) (*document-being-output*) + :autoload (skribilo biblio) (*bib-table* open-bib-file) :use-module (skribilo debug) :re-export (file-size) ;; re-exported from `(skribilo utils files)' @@ -207,6 +208,18 @@ (or (find-markups ident) '())) + +;;; +;;; Bibliography. +;;; + +(define-public (default-bib-table) + (*bib-table*)) + +(define-public (skribe-open-bib-file file command) + (open-bib-file file command)) + + ;;; ;;; Debugging facilities. -- cgit v1.2.3 From 9d5dfa5b32e1dcf98cb4878322d00150477a8225 Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Sat, 2 Dec 2006 10:41:59 +0000 Subject: doc: Documented `eq' and the `:div-style' option. * doc/user/char.skb (Symbols): Added an ident. * doc/user/eq.skb (Equation Formatting)[Summary]: New section. Use `doc-markup' as should have already been the case and document `:div-style'. git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-23 --- doc/user/char.skb | 1 + doc/user/eq.skb | 26 +++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'doc/user') diff --git a/doc/user/char.skb b/doc/user/char.skb index 16c4625..b2f94e2 100644 --- a/doc/user/char.skb +++ b/doc/user/char.skb @@ -67,6 +67,7 @@ are replaced with the actual values of the arguments ,(param 'node).]) ;*--- Symbols ---------------------------------------------------------*/ (subsection :title "Symbols" + :ident "symbols" (p [The function ,(code "symbol") introduces special symbols in the produced file. Note that the rendering of symbols is unportable. It depends diff --git a/doc/user/eq.skb b/doc/user/eq.skb index a611f88..455832b 100644 --- a/doc/user/eq.skb +++ b/doc/user/eq.skb @@ -57,7 +57,7 @@ much like any other kind of markup. However, the resulting syntax is very verbose and hard to read.]) (p [Fortunately, the ,(tt [eq]) package allows for the use of a -much simple syntax. ] +much simpler syntax. ] (example-produce (example :legend "Example of a simple equation" @@ -69,10 +69,30 @@ may have already recognized its ,(emph [prefix notation]). Note that, unlike in the previous example, the equation itself if ,(emph [quoted]), that is, preceded by the ,(tt [']) sign. Additionally, when referring to a symbol (such as the Greek letter ,(symbol "phi")), you no longer -need to use the ,(tt [symbol]) markup (,(ref :text [see subsection] -:subsection "Symbols")).])) +need to use the ,(tt [symbol]) markup (,(numref :text [see Section] +:ident "symbols")).])) + ;; FIXME: Write this. (section :title [Rendering]) + + (section :title [Summary] + + (p [The options available for the top-level ,(code [eq]) markup +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 +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.]) + (: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 +[:div-style]) options override this setting.])) + :source "skribilo/package/eq.scm")) ) -- cgit v1.2.3 From 67142b1e7b350765ce68cb0b89668d5b3abc034b Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Sat, 2 Dec 2006 10:45:56 +0000 Subject: doc: Augmented the `eq' doc, documented `eq-display'. git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-27 --- doc/user/eq.skb | 25 +++++++++++++++++++++++-- doc/user/src/eq3.skb | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 doc/user/src/eq3.skb (limited to 'doc/user') diff --git a/doc/user/eq.skb b/doc/user/eq.skb index 455832b..1ef0208 100644 --- a/doc/user/eq.skb +++ b/doc/user/eq.skb @@ -70,7 +70,16 @@ unlike in the previous example, the equation itself if ,(emph [quoted]), that is, preceded by the ,(tt [']) sign. Additionally, when referring to a symbol (such as the Greek letter ,(symbol "phi")), you no longer need to use the ,(tt [symbol]) markup (,(numref :text [see Section] -:ident "symbols")).])) +:ident "symbols")).]) + + (p [It is possible to create ,(emph [equation display blocks]), +where several equations are displayed and aligned according to a +particular operator. ] + + (example-produce + (example :legend "Inlined, displayed, and aligned equations" + (prgm :file "src/eq3.skb")) + (disp (include "src/eq3.skb"))))) ;; FIXME: Write this. (section :title [Rendering]) @@ -91,7 +100,19 @@ render equations in HTML.]) (: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 -[:div-style]) options override this setting.])) +[:div-style]) options override this setting.]) + (:align-with [Within a ,(code [eq-display]) block, +this should be a symbol specifying according to which operator equations +are to be aligned with one another.])) + :source "skribilo/package/eq.scm") + + (p [Equation display blocks can be defined using ,(code +[eq-display]). Display blocks define the scope of the alignment among +equations as specified by the ,(code [:align-with]) options of ,(code +[eq]).]) + + (doc-markup 'eq-display + `() :source "skribilo/package/eq.scm")) ) diff --git a/doc/user/src/eq3.skb b/doc/user/src/eq3.skb new file mode 100644 index 0000000..e229b6c --- /dev/null +++ b/doc/user/src/eq3.skb @@ -0,0 +1,38 @@ +(p [This paragraph contains this equation: ,(eq :inline? #t '(/ alpha +beta)). This is actually an ,(emph [inline]) equation, meaning that it +occurs within a paragraph. Typesetting has to be adjusted +accordingly.]) + +(eq-display + + (p [This is an equation display block, within which equations can be +aligned with one another.]) + + (eq :ident "eq-limit-b-over-l" + :renderer 'lout + :align-with '= + '(= (limit (/ lambda beta) 0 + (apply IPL n k)) + + ;; non-simplified + (/ (expt (+ alpha beta) k) + (* beta + (sum :from (= x 0) + :to (- k 1) + (* (combinations k x) + (expt beta (- k 1 x)) + (expt alpha x))))))) + + [This equation can be simplified as follows:] + + (eq :ident "eq-limit-b-over-l-simplified" + :renderer 'lout + :align-with '= + '(= ;; simplified + (/ (expt (+ alpha beta) k) + (- (expt (+ alpha beta) k) + (expt alpha k))) + + (limit (/ lambda beta) 0 + (apply IPL n k))))) + -- cgit v1.2.3 From fedce06edf8768b927ca91fb22ade620ac77ec2a Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Sun, 3 Dec 2006 21:54:14 +0000 Subject: doc: Updated the `eq' markup documentation. * doc/user/eq.skb: Updated documentation of `eq': the `inline?' parameter and the `:mul-style' parameter. git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-33 --- ChangeLog | 14 ++++++++++++++ doc/user/eq.skb | 11 ++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'doc/user') diff --git a/ChangeLog b/ChangeLog index 4a740d7..52f6d53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,20 @@ # arch-tag: automatic-ChangeLog--lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2 # +2006-12-03 20:02:17 GMT Ludovic Courtes 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 patch-90 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 -- cgit v1.2.3