aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLudovic Court`es2007-01-16 17:09:48 +0000
committerLudovic Court`es2007-01-16 17:09:48 +0000
commit9395c1b3be80daa14c6f9e3de0aca8aa9670fc16 (patch)
tree97505651f28a39d4d9d2038ded02f02ef11bdafb /src
parent71f36fef3f9c1d0415c13f07d9cc1c97417de96f (diff)
downloadskribilo-9395c1b3be80daa14c6f9e3de0aca8aa9670fc16.tar.gz
skribilo-9395c1b3be80daa14c6f9e3de0aca8aa9670fc16.tar.lz
skribilo-9395c1b3be80daa14c6f9e3de0aca8aa9670fc16.zip
LaTeX engine: Added support for classes without `chapter'.
* src/guile/skribilo/engine/latex.scm (latex-engine)[class-has-chapters?]: New custom, default to `#f'. This allows the production of documents really suitable for the `article' class. (latex-block-before)[%chapter-mapping, %chapterless-mapping]: New. Use them. git-archimport-id: lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-1
Diffstat (limited to 'src')
-rw-r--r--src/guile/skribilo/engine/latex.scm23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/guile/skribilo/engine/latex.scm b/src/guile/skribilo/engine/latex.scm
index 21ff6c5..407e1b3 100644
--- a/src/guile/skribilo/engine/latex.scm
+++ b/src/guile/skribilo/engine/latex.scm
@@ -1,6 +1,7 @@
;;; latex.scm -- LaTeX engine.
;;;
;;; Copyright 2003, 2004 Manuel Serrano
+;;; Copyright 2007 Ludovic Courtès <ludovic.courtes@laas.fr>
;;;
;;;
;;; This program is free software; you can redistribute it and/or modify
@@ -329,6 +330,7 @@
:delegate (find-engine 'base)
:filter (make-string-replace latex-encoding)
:custom '((documentclass "\\documentclass{article}")
+ (class-has-chapters? #f)
(usepackage "\\usepackage{epsfig}\n")
(predocument "\\newdimen\\oldframetabcolsep\n\\newdimen\\oldcolortabcolsep\n\\newdimen\\oldpretabcolsep\n")
(postdocument #f)
@@ -695,10 +697,27 @@
;* latex-block-before ... */
;*---------------------------------------------------------------------*/
(define (latex-block-before m)
+
+ ;; Mapping of Skribilo markups to LaTeX, with and without chapters.
+ (define %chapter-mapping
+ '((chapter . "chapter")
+ (section . "section")
+ (subsection . "subsection")
+ (subsubsection . "subsubsection")))
+ (define %chapterless-mapping
+ '((chapter . "section")
+ (section . "subsection")
+ (subsection . "subsubsection")
+ (subsubsection . "subsubsection")))
+
(lambda (n e)
- (let ((num (markup-option n :number)))
+ (let* ((num (markup-option n :number))
+ (markup-mapping (if (engine-custom e 'class-has-chapters?)
+ %chapter-mapping
+ %chapterless-mapping))
+ (latex-markup (cdr (assq m markup-mapping))))
(printf "\n\n%% ~a\n" (string-canonicalize (markup-ident n)))
- (printf "\\~a~a{" m (if (not num) "*" ""))
+ (printf "\\~a~a{" latex-markup (if (not num) "*" ""))
(output (markup-option n :title) latex-title-engine)
(display "}\n")
(when num