diff --git a/src/TeXmacs/progs/database/bib-manage.scm b/src/TeXmacs/progs/database/bib-manage.scm index 3ef9e42..5183e08 100644 --- a/src/TeXmacs/progs/database/bib-manage.scm +++ b/src/TeXmacs/progs/database/bib-manage.scm @@ -264,10 +264,17 @@ (define (bib-file? f) (and (url? f) (== (url-suffix f) "bib"))) +(tm-define (is-tm-bibtex-style? style) + (let ((style (or (and (string-starts? style "tm-") + (string-drop style 3)) + style))) + (not + (not + (search-path %load-path (string-append "bibtex/" style ".scm")))))) + (define (bib-compile-sub prefix style names . bib-files) (set! names (list-remove-duplicates names)) - (if (in? style (list "tm-abbrv" "tm-acm" "tm-alpha" "tm-elsart-num" - "tm-ieeetr" "tm-plain" "tm-siam" "tm-unsrt")) + (if (is-tm-bibtex-style? style) (let* ((all-files `(,@bib-files :default :attached)) (l (apply bib-retrieve-entries (cons names all-files))) (bl (map db->bib (map cdr l))) diff --git a/src/src/Edit/Process/edit_process.cpp b/src/src/Edit/Process/edit_process.cpp index 83594c8..0f8fa0b 100644 --- a/src/src/Edit/Process/edit_process.cpp +++ b/src/src/Edit/Process/edit_process.cpp @@ -110,16 +110,13 @@ edit_process_rep::generate_bibliography ( } } else t= bibtex_load_bbl (bib, bbl_file); + // cout << "bibtex_load_bbl:" << t << "\n";// DEBUG } else { if (!bibtex_present () && !starts (style, "tm-")) { - if (style == "abbrv") style= "tm-abbrv"; - else if (style == "acm") style= "tm-acm"; - else if (style == "alpha") style= "tm-alpha"; - else if (style == "elsart-num") style= "tm-elsart-num"; - else if (style == "ieeetr") style= "tm-ieeetr"; - else if (style == "siam") style= "tm-siam"; - else if (style == "unsrt") style= "tm-unsrt"; + if (as_bool (call (string ("is-tm-bibtex-style?"), "tm-" * style))) { + style= "tm-" * style; + } else style= "tm-plain"; } if (supports_db () && !is_rooted (bib_file))