From c6e6209a230c5d5681fde8ccc9305a0f243dfa57 Mon Sep 17 00:00:00 2001 From: davidmichel Date: Thu, 24 Jun 2010 13:12:46 +0000 Subject: [PATCH] indented BibTeX styles git-svn-id: svn://svn.savannah.gnu.org/texmacs/trunk@2976 64cb5145-927a-446d-8aed-2fb7b4773692 --- src/TeXmacs/progs/bibtex/abbrv.scm | 37 ++++ src/TeXmacs/progs/bibtex/acm.scm | 279 ++++++++++++++++++++++++ src/TeXmacs/progs/bibtex/alpha.scm | 1 + src/TeXmacs/progs/bibtex/bib-utils.scm | 6 +- src/TeXmacs/progs/bibtex/elsart-num.scm | 289 +++++++++++++++++++++++++ src/TeXmacs/progs/bibtex/ieeetr.scm | 1 + src/TeXmacs/progs/bibtex/plain.scm | 3 +- src/TeXmacs/progs/bibtex/siam.scm | 1 + src/TeXmacs/progs/convert/bibtex/bibtexout.scm | 1 + src/TeXmacs/progs/convert/bibtex/bibtextm.scm | 1 + src/TeXmacs/progs/convert/latex/tmtex.scm | 3 +- src/TeXmacs/progs/convert/tools/output.scm | 2 + src/TeXmacs/progs/init-texmacs.scm | 10 + src/TeXmacs/styles/bibtex/bibliography.ts | 129 +++++++++++ src/src/Data/Convert/BibTeX/parsebib.cpp | 1 + 15 files changed, 760 insertions(+), 4 deletions(-) create mode 100644 src/TeXmacs/progs/bibtex/abbrv.scm create mode 100644 src/TeXmacs/progs/bibtex/acm.scm create mode 100644 src/TeXmacs/progs/bibtex/elsart-num.scm create mode 100644 src/TeXmacs/styles/bibtex/bibliography.ts diff --git a/src/TeXmacs/progs/bibtex/abbrv.scm b/src/TeXmacs/progs/bibtex/abbrv.scm new file mode 100644 index 00000000..68943c79 --- /dev/null +++ b/src/TeXmacs/progs/bibtex/abbrv.scm @@ -0,0 +1,37 @@ + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; MODULE : abbrv.scm +;; DESCRIPTION : abbrv style for BibTeX files +;; COPYRIGHT : (C) 2010 David MICHEL +;; +;; This software falls under the GNU general public license version 3 or later. +;; It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE +;; in the root directory or . +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(texmacs-module (bibtex abbrv) + (:use (bibtex bib-utils))) + +(bib-define-style "abbrv" "plain") + +(tm-define (format-name x) + (:mode bib-abbrv?) + (let* ((f (if (empty? (list-ref x 1)) + "" + `(concat ,(bib-abbreviate (list-ref x 1) "." `(nbsp)) + (nbsp)))) + (vv (if (empty? (list-ref x 2)) "" `(concat ,(list-ref x 2) (nbsp)))) + (ll (if (empty? (list-ref x 3)) "" (list-ref x 3))) + (jj (if (empty? (list-ref x 4)) "" `(concat ", " ,(list-ref x 4))))) + `(concat ,f ,vv ,ll ,jj))) + +(tm-define (format-pages x) + (:mode bib-abbrv?) + (let* ((p (bib-field x "pages"))) + (cond + ((equal? 1 (length p)) "") + ((equal? 2 (length p)) `(concat "pp. " ,(list-ref p 1))) + (else `(concat "pp. " ,(list-ref p 1) "--" ,(list-ref p 2)))))) + diff --git a/src/TeXmacs/progs/bibtex/acm.scm b/src/TeXmacs/progs/bibtex/acm.scm new file mode 100644 index 00000000..1ce30d14 --- /dev/null +++ b/src/TeXmacs/progs/bibtex/acm.scm @@ -0,0 +1,279 @@ + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; MODULE : acm.scm +;; DESCRIPTION : acm style for BibTeX files +;; COPYRIGHT : (C) 2010 David MICHEL +;; +;; This software falls under the GNU general public license version 3 or later. +;; It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE +;; in the root directory or . +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(texmacs-module (bibtex acm) + (:use (bibtex bib-utils))) + +(bib-define-style "acm" "plain") + +(tm-define (format-name x) + (:mode bib-acm?) + (let* ((f (if (empty? (list-ref x 1)) + "" + `(concat ", " ,(bib-abbreviate (list-ref x 1) "." `(nbsp))))) + (vv (if (empty? (list-ref x 2)) "" `(concat ,(list-ref x 2) (nbsp)))) + (ll (if (empty? (list-ref x 3)) "" (list-ref x 3))) + (jj (if (empty? (list-ref x 4)) "" `(concat ", " ,(list-ref x 4))))) + `(with "font-shape" "small-caps" (concat ,vv ,ll ,jj ,f)))) + +(tm-define (format-editor x) + (:mode bib-acm?) + (let* ((a (bib-field x "editor"))) + (if (empty? a) + "" + (if (equal? (length a) 2) + `(concat ,(format-names a) ,(bib-translate ", Ed.")) + `(concat ,(format-names a) ,(bib-translate ", Eds.")))))) + +(tm-define (format-date x) + (:mode bib-acm?) + (let* ((y (bib-field x "year")) + (m (bib-field x "month"))) + (if (empty? y) + (if (empty? m) "" m) + (if (empty? m) y `(concat ,m " " ,y))))) + +(tm-define (format-in-ed-booktitle x) + (:mode bib-acm?) + (let* ((b (bib-field x "booktitle")) + (a (bib-field x "address")) + (cl `(concat " (" ,(new-list ", " `(,a ,(format-date x))) ")"))) + (if (empty? b) + "" + `(concat + ,(bib-translate "in ") + (with "font-shape" "italic" ,b) ,cl)))) + +(tm-define (format-volume-or-number x) + (:mode bib-acm?) + (let* ((v (bib-field x "volume")) + (n (bib-field x "number")) + (s (bib-field x "series"))) + (if (empty? v) + (if (empty? n) + (if (empty? s) "" s) + (let ((series (if (empty? s) + "" + `(concat ,(bib-translate " in ") ,s))) + (sep (if (< (bib-text-length n) 3) `(nbsp) " "))) + `(concat "no." ,sep ,n ,series))) + (let ((series (if (empty? s) + "" + `(concat ,(bib-translate " of ") + (with "font-shape" "italic" ,s)))) + (sep (if (< (bib-text-length v) 3) `(nbsp) " "))) + `(concat "vol." ,sep ,v ,series))))) + +(tm-define (format-pages x) + (:mode bib-acm?) + (let* ((p (bib-field x "pages"))) + (cond + ((equal? 1 (length p)) "") + ((equal? 2 (length p)) `(concat ,(bib-translate "p. ") ,(list-ref p 1))) + (else `(concat ,(bib-translate "p. ") + ,(list-ref p 1) "--" ,(list-ref p 2)))))) + +(tm-define (format-chapter-pages x) + (:mode bib-acm?) + (let* ((c (bib-field x "chapter")) + (t (bib-field x "type"))) + (if (empty? c) + (format-pages x) + (let ((type (if (empty? t) + ,(bib-translate "chapter") + (bib-locase t))) + (pages `(concat ", " ,(format-pages x)))) + `(concat ,type " " ,c ,pages))))) + +(tm-define (format-tr-number x) + (:mode bib-acm?) + (let* ((t (bib-field x "type")) + (n (bib-field x "number")) + (type (if (empty? t) ,(bib-translate "Technical Report") t)) + (number (if (empty? n) "" n)) + (sep (if (< (bib-text-length n) 3) `(nbsp) " "))) + `(concat ,type ,sep ,number))) + +(tm-define (format-edition x) + (:mode bib-acm?) + (let* ((e (bib-field x "edition"))) + (if (empty? e) "" `(concat ,e " ed.")))) + +(tm-define (format-bibitem n x) + (:mode bib-acm?) + `(bibitem* ,(number->string n))) + +(tm-define (format-article n x) + (:mode bib-acm?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-list-spc + `(,(new-block (format-author x)) + ,(new-block (format-field-Locase x "title")) + ,(new-block + (if (bib-empty? x "crossref") + (new-sentence + `(,(emphasize `(concat ,(format-field x "journal") + " " + ,(format-field x "volume"))) + (concat ,(format-field x "number") + " (" + ,(format-date x) ")") + ,(format-pages x))) + (new-sentence + `((concat ,(bib-translate "in ") + (cite ,(bib-field x "crossref"))) + ,(format-pages x))))) + ,(new-block (format-field x "note")))))) + +(tm-define (format-book n x) + (:mode bib-acm?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-list-spc + `(,(new-block (if (bib-empty? x "author") + (format-editor x) + (format-author x))) + ,(new-block + (new-sentence + `(,(emphasize (format-field x "title")) + ,(format-edition x)))) + ,(new-block + (if (bib-empty? x "crossref") + (new-list-spc + `(,(new-sentence `(,(format-number-series x))) + ,(new-sentence + `(,(format-field x "publisher") + ,(format-field x "address") + ,(format-date x))))) + (new-sentence + `((concat ,(bib-translate "in ") + (cite ,(bib-field x "crossref"))) + ,(format-field x "edition") + ,(format-date x))))) + ,(new-block (format-field x "note")))))) + +(tm-define (format-inbook n x) + (:mode bib-acm?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-list-spc + `(,(new-block (if (bib-empty? x "author") + (format-editor x) + (format-author x))) + ,(new-block + (new-sentence + `(,(emphasize (format-field x "title"))))) + ,(new-block + (if (bib-empty? x "crossref") + (new-list-spc + `(,(new-sentence `(,(format-number-series x))) + ,(new-sentence + `(,(format-field x "publisher") + ,(format-field x "address") + ,(format-date x) + ,(format-chapter-pages x))))) + (new-sentence + `((concat ,(bib-translate "in ") + (cite ,(bib-field x "crossref"))) + ,(format-field x "edition") + ,(format-date x))))) + ,(new-block (format-field x "note")))))) + +(tm-define (format-incollection n x) + (:mode bib-acm?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-list-spc + `(,(new-block (format-author x)) + ,(new-block (format-field-Locase x "title")) + ,(new-block + (if (bib-empty? x "crossref") + (new-list-spc + `(,(new-sentence + `((concat ,(bib-translate "in ") + ,(emphasize (format-field x "booktitle"))) + ,(format-editor x) + ,(format-edition x) + ,(format-volume-or-number x))) + ,(new-sentence + `(,(format-field x "publisher") + ,(format-field x "address") + ,(format-date x) + ,(format-chapter-pages x))))) + (new-sentence + `((concat ,(bib-translate "in ") + (cite ,(bib-field x "crossref"))) + ,(format-chapter-pages x))))) + ,(new-block (format-field x "note")))))) + +(tm-define (format-inproceedings n x) + (:mode bib-acm?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-list-spc + `(,(new-block (format-author x)) + ,(new-block (format-field-Locase x "title")) + ,(new-block + (if (bib-empty? x "crossref") + (new-list-spc + `(,(new-sentence + `(,(format-in-ed-booktitle x) + ,(format-editor x) + ,(format-volume-or-number x) + ,(format-field x "organization") + ,(format-field x "publisher") + ,(format-pages x))))) + (new-sentence + `((concat ,(bib-translate "in ") + (cite ,(bib-field x "crossref"))) + ,(format-pages x))))) + ,(new-block (format-field x "note")))))) + +(tm-define (format-manual n x) + (:mode bib-acm?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-list-spc + `(,(new-block (format-author x)) + ,(new-block + (new-sentence + `(,(emphasize (format-field x "title")) + ,(format-edition x) + ,(format-field x "organization") + ,(format-field x "address") + ,(format-date x)))) + ,(new-block (format-field x "note")))))) + +(tm-define (format-proceedings n x) + (:mode bib-acm?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-list-spc + `(,(new-block + (if (bib-empty? x "editor") + (format-field x "organization") + (format-editor x))) + ,(new-block + (new-sentence + `((concat ,(emphasize (format-field x "title")) + " (" + ,(new-list ", " + `(,(format-field x "address") + ,(format-date x))) + ")") + ,(format-volume-or-number x) + ,(format-field x "organization") + ,(format-field x "publisher")))) + ,(new-block (format-field x "note")))))) + diff --git a/src/TeXmacs/progs/bibtex/alpha.scm b/src/TeXmacs/progs/bibtex/alpha.scm index 37d5083d..22ec3d75 100644 --- a/src/TeXmacs/progs/bibtex/alpha.scm +++ b/src/TeXmacs/progs/bibtex/alpha.scm @@ -115,3 +115,4 @@ (let ((label (hash-ref bib-key-table (list-ref x 2))) (lplain (bib-with-style "plain" bib-sort-key x))) (string-append (invert-label label) " " lplain))) + diff --git a/src/TeXmacs/progs/bibtex/bib-utils.scm b/src/TeXmacs/progs/bibtex/bib-utils.scm index 236d1145..b4bfa4ed 100644 --- a/src/TeXmacs/progs/bibtex/bib-utils.scm +++ b/src/TeXmacs/progs/bibtex/bib-utils.scm @@ -106,8 +106,11 @@ (tm-define (new-list-spc x) (new-list-rec " " (elim-empty x))) +(tm-define (new-list c x) + (new-list-rec c (elim-empty x))) + (tm-define (new-sentence x) - (bib-add-period (bib-upcase-first (new-list-rec ", " (elim-empty x))))) + (bib-add-period (bib-upcase-first (new-list ", " x)))) (tm-define (format-field x s) (with e (bib-field x s) @@ -122,3 +125,4 @@ (tm-define (bib-translate s) (translate s "english" (get-env "language"))) + diff --git a/src/TeXmacs/progs/bibtex/elsart-num.scm b/src/TeXmacs/progs/bibtex/elsart-num.scm new file mode 100644 index 00000000..36053345 --- /dev/null +++ b/src/TeXmacs/progs/bibtex/elsart-num.scm @@ -0,0 +1,289 @@ + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; MODULE : elsart-num.scm +;; DESCRIPTION : elsart-num style for BibTeX files +;; COPYRIGHT : (C) 2010 David MICHEL +;; +;; This software falls under the GNU general public license version 3 or later. +;; It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE +;; in the root directory or . +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(texmacs-module (bibtex elsart-num) + (:use (bibtex bib-utils))) + +(bib-define-style "elsart-num" "plain") + +(tm-define (format-name x) + (:mode bib-elsart-num?) + (let* ((f (if (empty? (list-ref x 1)) + "" + `(concat ,(bib-abbreviate (list-ref x 1) "." `(nbsp))))) + (vv (if (empty? (list-ref x 2)) "" `(concat ,(list-ref x 2) (nbsp)))) + (ll (if (empty? (list-ref x 3)) "" (list-ref x 3))) + (jj (if (empty? (list-ref x 4)) "" `(concat ", " ,(list-ref x 4))))) + `(concat ,f ,vv ,ll ,jj))) + +(tm-define (format-editor x) + (:mode bib-elsart-num?) + (let* ((a (bib-field x "editor"))) + (if (empty? a) + "" + (if (equal? (length a) 2) + `(concat ,(format-names a) ,(bib-translate " (Ed.)")) + `(concat ,(format-names a) ,(bib-translate " (Eds.)")))))) + +(tm-define (format-edition x) + (:mode bib-elsart-num?) + (let* ((e (bib-field x "edition"))) + (if (empty? e) "" `(concat ,e " Edition")))) + +(tm-define (format-volume-or-number x) + (:mode bib-elsart-num?) + (let* ((v (bib-field x "volume")) + (n (bib-field x "number")) + (s (bib-field x "series"))) + (if (empty? v) + (if (empty? n) + (if (empty? s) "" s) + (let ((series (if (empty? s) + "" + `(concat ,(bib-translate " in ") ,s))) + (sep (if (< (bib-text-length n) 3) `(nbsp) " "))) + `(concat "No." ,sep ,n ,series))) + (let ((series (if (empty? s) + "" + `(concat ,(bib-translate " of ") ,s))) + (sep (if (< (bib-text-length v) 3) `(nbsp) " "))) + `(concat "Vol." ,sep ,v ,series))))) + +(tm-define (format-pages x) + (:mode bib-elsart-num?) + (let* ((p (bib-field x "pages"))) + (cond + ((equal? 1 (length p)) "") + ((equal? 2 (length p)) `(concat ,(bib-translate "pp. ") + ,(list-ref p 1))) + (else `(concat ,(bib-translate "pp. ") + ,(list-ref p 1) "--" ,(list-ref p 2)))))) + +(tm-define (format-vol-num-pages x) + (:mode bib-elsart-num?) + (let* ((j (bib-field x "journal")) + (v (bib-field x "volume")) + (n `(concat "(" ,(bib-field x "number") ")")) + (y `(concat "(" ,(bib-field x "year") ")")) + (p (let* ((pp (bib-field x "pages"))) + (cond + ((equal? 1 (length pp)) "") + ((equal? 2 (length pp)) (list-ref pp 1)) + (else `(concat ,(list-ref pp 1) "--" ,(list-ref pp 2))))))) + (new-list " " `(,j ,v ,n ,y ,p)))) + +(tm-define (format-article n x) + (:mode bib-elsart-num?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-block + (new-sentence + `(,(format-author x) + ,(format-field-Locase x "title") + ,@(if (bib-empty? x "crossref") + `(,(format-vol-num-pages x)) + `((concat ,(bib-translate "in ") + (cite ,(bib-field x "crossref"))) + ,(format-pages x))) + ,(format-field x "note")))))) + +(tm-define (format-book n x) + (:mode bib-elsart-num?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-block + (new-sentence + `(,(if (bib-empty? x "author") + (format-editor x) + (format-author x)) + ,(format-field x "title") + ,(format-edition x) + ,@(if (bib-empty? x "crossref") + `(,(format-volume-or-number x) + ,(format-field x "publisher") + ,(format-field x "address")) + `((concat ,(bib-translate "in ") + (cite ,(bib-field x "crossref"))) + ,(format-edition x ))) + ,(format-field x "year") + ,(format-field x "note")))))) + +(tm-define (format-booklet n x) + (:mode bib-elsart-num?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-block + (new-sentence + `(,(format-author x) + ,(format-field-Locase x "title") + ,(format-field x "howpublished") + ,(format-field x "address") + (concat ,(if (bib-empty? x "note") + "" + `(concat ,(format-field x "note") " ")) + "(" ,(format-date x) ")")))))) + +(tm-define (format-inbook n x) + (:mode bib-elsart-num?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-block + (new-sentence + `(,(if (bib-empty? x "author") + (format-editor x) + (format-author x)) + ,(format-field x "title") + ,@(if (bib-empty? x "crossref") + `(,(format-edition x) + ,(format-volume-or-number x) + ,(format-field x "publisher") + ,(format-field x "address") + ,(format-field x "year") + ,(format-chapter-pages x)) + `((concat ,(bib-translate "in ") + (cite ,(bib-field x "crossref"))) + ,(format-field x "edition") + ,(format-field x "year"))) + ,(format-field x "note")))))) + +(tm-define (format-incollection n x) + (:mode bib-elsart-num?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-block + (new-sentence + `(,(format-author x) + ,(format-field-Locase x "title") + ,@(if (bib-empty? x "crossref") + `((concat ,(bib-translate "in: ") + ,(format-editor x)) + ,(format-field x "booktitle") + ,(format-edition x) + ,(format-volume-or-number x) + ,(format-field x "publisher") + ,(format-field x "address") + ,(format-field x "year")) + `((concat ,(bib-translate "in ") + (cite ,(bib-field x "crossref"))))) + ,(format-chapter-pages x) + ,(format-field x "note")))))) + +(tm-define (format-inproceedings n x) + (:mode bib-elsart-num?) + (format-incollection n x)) + +(tm-define (format-manual n x) + (:mode bib-elsart-num?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-block + (new-sentence + `(,@(if (bib-empty? x "author") + (if (bib-empty? x "organization") + `() + `(,(format-field x "organization") + ,(format-field x "address"))) + `(,(format-author x))) + ,(format-field x "title") + ,(format-field x "organization") + ,(format-field x "address") + ,(format-edition x) + (concat ,(if (bib-empty? x "note") + "" + `(concat ,(format-field x "note") " ")) + "(" ,(format-date x) ")")))))) + +(tm-define (format-mastersthesis n x) + (:mode bib-elsart-num?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-block + (new-sentence + `(,(format-author x) + ,(format-field-Locase x "title") + ,(if (bib-empty? x "type") + ,(bib-translate "Master's thesis") + (format-field x "type")) + ,(format-field x "school") + ,(format-field x "address") + (concat ,(if (bib-empty? x "note") + "" + `(concat ,(format-field x "note") " ")) + "(" ,(format-date x) ")")))))) + +(tm-define (format-misc n x) + (:mode bib-plain?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-block + (new-sentence + `(,(format-author x) + ,(format-field-Locase x "title") + ,(format-field x "howpublished") + (concat ,(if (bib-empty? x "note") + "" + `(concat ,(format-field x "note") " ")) + "(" ,(format-date x) ")")))))) + +(tm-define (format-phdthesis n x) + (:mode bib-elsart-num?) + (format-mastersthesis n x)) + +(tm-define (format-proceedings n x) + (:mode bib-elsart-num?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-block + (new-sentence + `(,(if (bib-empty? x "editor") + (format-field x "organization") + (format-editor x)) + ,(format-field x "title") + ,(format-volume-or-number x) + ,(if (bib-empty? x "editor") + "" + (format-field x "organization")) + ,(format-field x "publisher") + ,(format-field x "address") + ,(format-field x "year") + ,(format-field x "note")))))) + +(tm-define (format-techreport n x) + (:mode bib-elsart-num?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-block + (new-sentence + `(,(format-author x) + ,(format-field-Locase x "title") + ,(format-tr-number x) + ,(format-field x "institution") + ,(format-field x "address") + (concat ,(if (bib-empty? x "note") + "" + `(concat ,(format-field x "note") " ")) + "(" ,(format-date x) ")")))))) + +(tm-define (format-unpublished n x) + (:mode bib-elsart-num?) + `(concat ,(format-bibitem n x) + (label ,(string-append "bib-" (list-ref x 2))) + ,(new-block + (new-sentence + `(,(format-author x) + ,(format-field-Locase x "title") + (concat ,(if (bib-empty? x "note") + "" + `(concat ,(format-field x "note") " ")) + "(" ,(format-date x) ")")))))) + diff --git a/src/TeXmacs/progs/bibtex/ieeetr.scm b/src/TeXmacs/progs/bibtex/ieeetr.scm index 6ebb0c06..8d9282fe 100644 --- a/src/TeXmacs/progs/bibtex/ieeetr.scm +++ b/src/TeXmacs/progs/bibtex/ieeetr.scm @@ -344,3 +344,4 @@ (new-sentence `(,(format-field x "note") ,(format-date x)))))))) + diff --git a/src/TeXmacs/progs/bibtex/plain.scm b/src/TeXmacs/progs/bibtex/plain.scm index ebd87933..76f97ee5 100644 --- a/src/TeXmacs/progs/bibtex/plain.scm +++ b/src/TeXmacs/progs/bibtex/plain.scm @@ -307,7 +307,7 @@ ,(new-block (if (bib-empty? x "crossref") (new-list-spc - `(,(new-sentenc + `(,(new-sentence `(,(format-in-ed-booktitle x) ,(format-bvolume x) ,(format-number-series x) @@ -528,3 +528,4 @@ (string-append pre " " (bib-field x "year") " " (bib-purify (bib-field x "title"))))) + diff --git a/src/TeXmacs/progs/bibtex/siam.scm b/src/TeXmacs/progs/bibtex/siam.scm index d041747f..41190733 100644 --- a/src/TeXmacs/progs/bibtex/siam.scm +++ b/src/TeXmacs/progs/bibtex/siam.scm @@ -351,3 +351,4 @@ (new-sentence `(,(format-field x "note") ,(format-date x)))))))) + diff --git a/src/TeXmacs/progs/convert/bibtex/bibtexout.scm b/src/TeXmacs/progs/convert/bibtex/bibtexout.scm index 934c56d1..a5b1a509 100644 --- a/src/TeXmacs/progs/convert/bibtex/bibtexout.scm +++ b/src/TeXmacs/progs/convert/bibtex/bibtexout.scm @@ -267,3 +267,4 @@ (tm-define (serialize-bibtex x) (bibtexout x) (output-produce)) + diff --git a/src/TeXmacs/progs/convert/bibtex/bibtextm.scm b/src/TeXmacs/progs/convert/bibtex/bibtextm.scm index 456d2fa7..ed194b8c 100644 --- a/src/TeXmacs/progs/convert/bibtex/bibtextm.scm +++ b/src/TeXmacs/progs/convert/bibtex/bibtextm.scm @@ -34,3 +34,4 @@ (let* ((snippet? (not (func? bib '!file 1))) (body (if snippet? bib (cadr bib)))) body)) + diff --git a/src/TeXmacs/progs/convert/latex/tmtex.scm b/src/TeXmacs/progs/convert/latex/tmtex.scm index 45f824d4..c23d5185 100644 --- a/src/TeXmacs/progs/convert/latex/tmtex.scm +++ b/src/TeXmacs/progs/convert/latex/tmtex.scm @@ -1695,8 +1695,6 @@ (cond ((== x what) #t) ((nlist? x) #f) (else (list-or (map (cut find? <> what) x))))) - -(tm-define (texmacs->latex x opts) ;;(display* "texmacs->latex [" opts "], " x "\n") (if (tmfile? x) (let* ((body (tmfile-extract x 'body)) @@ -1722,3 +1720,4 @@ (if (not tmtex-use-catcodes?) (set! r (latex-expand-catcodes r))) r)))) + diff --git a/src/TeXmacs/progs/convert/tools/output.scm b/src/TeXmacs/progs/convert/tools/output.scm index b0a2c9b1..bbb608e9 100644 --- a/src/TeXmacs/progs/convert/tools/output.scm +++ b/src/TeXmacs/progs/convert/tools/output.scm @@ -45,6 +45,7 @@ (set! output-space-flag #f) (set! output-break-flag #t) (set! output-tail "") +;; (display* "OUTPUT\n" r "\n") r)) (tm-define (output-indent plus) @@ -140,3 +141,4 @@ ;(display-err* "Output text " ss "\n") (let ((s (apply string-append (cons output-tail ss)))) (output-sub s 0))) + diff --git a/src/TeXmacs/progs/init-texmacs.scm b/src/TeXmacs/progs/init-texmacs.scm index 5239b6ef..582f5110 100644 --- a/src/TeXmacs/progs/init-texmacs.scm +++ b/src/TeXmacs/progs/init-texmacs.scm @@ -55,6 +55,16 @@ (lazy-define (utils cas cas-out) cas->stree) ;(display* "time: " (- (texmacs-time) boot-start) "\n") +;; BibTeX style modules +(use-modules (bibtex bib-utils)) +(use-modules (bibtex plain)) +(use-modules (bibtex alpha)) +(use-modules (bibtex abbrv)) +(use-modules (bibtex acm)) +(use-modules (bibtex ieeetr)) +(use-modules (bibtex siam)) +(use-modules (bibtex elsart-num)) + ;(display "Booting main TeXmacs functionality\n") (use-modules (texmacs texmacs tm-server) (texmacs texmacs tm-view) (texmacs texmacs tm-files) (texmacs texmacs tm-print)) diff --git a/src/TeXmacs/styles/bibtex/bibliography.ts b/src/TeXmacs/styles/bibtex/bibliography.ts new file mode 100644 index 00000000..e67e9c7c --- /dev/null +++ b/src/TeXmacs/styles/bibtex/bibliography.ts @@ -0,0 +1,129 @@ + + + + +<\body> + <\active*> + <\src-title> + + + <\src-purpose> + The bibliography style. + + + <\src-copyright|1998--2004> + Joris van der Hoeven + + + <\src-license> + This software falls under the . It comes WITHOUT ANY + WARRANTY WHATSOEVER. You should have received a copy of the license + which the software. If not, see . + + + + + + + + + > + + + |> + > + + >>> + + >>>> + + >>> + + + |||||||||>>>|<\cell> + |bib-var||> + >>>> + > + + >>>|||>>> + + >>>|||>>> + + + <\padded-normal|0.25em|1.5em> + <\wide-std-framed-colored||> + |>|: + >|>> + + + |> + + > + + + <\with|mfield|>>>|||>>> + |dark blue|pastel blue|dark + green||||> + + > + + + <\padded-normal|0.25em|1.5em> + <\wide-std-framed-colored|dark green|pastel green> + + + + >>>|||>>|bib-comment|>>>|||>>|>>|> + + > + + + <\padded-normal|0.25em|1.5em> + <\wide-std-framed-colored|dark orange|pastel orange> + + + + >>|bib-comment||>>|>>|par-left|1.5em|par-first|0|> + + > + + + <\with|bib-field|>>>|||>>|bib-line||>>> + |dark + grey|pastel grey|dark grey||||>>|par-first|0|>> + + > + + >|0>| + >>|0>|> + >>>|0>|, + > >>> + + >> + + >>> + + >> + + >>> + + >> + + +<\initial> + <\collection> + + + \ No newline at end of file diff --git a/src/src/Data/Convert/BibTeX/parsebib.cpp b/src/src/Data/Convert/BibTeX/parsebib.cpp index 7a479115..5bbea544 100644 --- a/src/src/Data/Convert/BibTeX/parsebib.cpp +++ b/src/src/Data/Convert/BibTeX/parsebib.cpp @@ -356,3 +356,4 @@ parse_bib (string s) { } return r; } + -- 2.11.4.GIT