summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLudovic Court`es2007-01-18 14:54:51 +0000
committerLudovic Court`es2007-01-18 14:54:51 +0000
commite78ee03ca101700ee5839f6a86037d3028d65ae3 (patch)
tree9cd8f67b78a4c7204cefe8ba05e86b4cecf45400 /src
parent394794351dcde758245277c12ea064e0badcf106 (diff)
downloadskribilo-e78ee03ca101700ee5839f6a86037d3028d65ae3.tar.gz
skribilo-e78ee03ca101700ee5839f6a86037d3028d65ae3.tar.lz
skribilo-e78ee03ca101700ee5839f6a86037d3028d65ae3.zip
`lncs' package: Use a native LaTeX/BibTeX bibliography.
* src/guile/skribilo/package/lncs.scm: Added LaTeX writers for `bib-ref',
  `bib-ref+', `&the-bibliography', `&bib-entry-body' and `&bib-entry'.

git-archimport-id: lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-5
Diffstat (limited to 'src')
-rw-r--r--src/guile/skribilo/package/lncs.scm59
1 files changed, 58 insertions, 1 deletions
diff --git a/src/guile/skribilo/package/lncs.scm b/src/guile/skribilo/package/lncs.scm
index a5d06d3..abc87dd 100644
--- a/src/guile/skribilo/package/lncs.scm
+++ b/src/guile/skribilo/package/lncs.scm
@@ -27,16 +27,33 @@
   :autoload   (skribilo package base)   (section font flush
                                          toc the-bibliography)
   :autoload   (skribilo utils keywords) (the-options the-body)
+  :autoload   (skribilo biblio template)(output-bib-entry-template
+                                         make-bib-entry-template/default)
 
   :use-module (skribilo lib)
   :use-module (skribilo utils syntax)
 
   :use-module (ice-9 optargs)
+  :use-module (srfi srfi-13)
 
   :export (abstract references))
 
 (fluid-set! current-reader %skribilo-module-reader)
 
+;;; Author: Manuel Serrano, Ludovic Courtès
+;;;
+;;; Commentary:
+;;;
+;;; This module provides support for writing articles for the ``Lecture Notes
+;;; in Computer Science'' series (LNCS) published by Springer-Verlag.
+;;;
+;;; Since Springer provides a LaTeX class (called `llncs') and expects you to
+;;; submit articles only in LaTeX, this module tries hard to use native LaTeX
+;;; constructs when the LaTeX engine is being used, so that you can pass the
+;;; generated TeX file to Springer-Verlag and make them happy.
+;;;
+;;; Code:
+
 
 ;*---------------------------------------------------------------------*/
 ;*    LaTeX global customizations                                      */
@@ -192,4 +209,44 @@
       ;; Use the `abstract' command provided by the `llncs' class.
       (markup-writer 'lncs-abstract latex
          :before "\n\\begin{abstract}\n"
-         :after  "\n\\end{abstract}\n"))))
+         :after  "\n\\end{abstract}\n")
+
+
+      ;; Use the native bibliography system (BibTeX).
+
+      (markup-writer 'bib-ref latex
+         :options '(:text :bib)
+         :action (lambda (n e)
+                   (let ((entry (handle-ast (markup-body n))))
+                     (format #t "\\cite{~a}" (markup-ident entry)))))
+
+      (markup-writer 'bib-ref+ latex
+         :options '(:text :bib)
+         :action (lambda (n e)
+                   (let ((entries (map (lambda (bib-ref)
+                                         (handle-ast (markup-body bib-ref)))
+                                       (markup-body n))))
+                     (format #t "\\cite{~a}"
+                             (string-join (map markup-ident entries)
+                                          ",")))))
+
+      (markup-writer '&the-bibliography latex
+         :before "\\begin{thebibliography}{}\n"
+         :after  "\\end{thebibliography}\n")
+
+      (markup-writer '&bib-entry-body
+         :action (lambda (n e)
+                   (let* ((kind (markup-option n 'kind))
+                          (template (make-bib-entry-template/default kind)))
+                     (output-bib-entry-template n e template))))
+
+      (markup-writer '&bib-entry latex
+         :action (lambda (n e)
+                   (display "%\n\\bibitem[")
+                   (output (markup-option n :title) e)
+                   (format #t "]{~a}\n" (markup-ident n))
+                   (output n e (markup-writer-get '&bib-entry-body e)))
+         :after "\n%\n"))))
+
+
+;;; lncs.scm ends here