aboutsummaryrefslogtreecommitdiff
path: root/src/guile
diff options
context:
space:
mode:
authorLudovic Court`es2007-01-16 17:31:05 +0000
committerLudovic Court`es2007-01-16 17:31:05 +0000
commitd18ee7ed0475b5d98dd3e3ee681882da697c0413 (patch)
tree97505651f28a39d4d9d2038ded02f02ef11bdafb /src/guile
parent929102c733f183c1819974323ad513b32261b81c (diff)
parent9395c1b3be80daa14c6f9e3de0aca8aa9670fc16 (diff)
downloadskribilo-d18ee7ed0475b5d98dd3e3ee681882da697c0413.tar.gz
skribilo-d18ee7ed0475b5d98dd3e3ee681882da697c0413.tar.lz
skribilo-d18ee7ed0475b5d98dd3e3ee681882da697c0413.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: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-38
Diffstat (limited to 'src/guile')
-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