From 9395c1b3be80daa14c6f9e3de0aca8aa9670fc16 Mon Sep 17 00:00:00 2001 From: Ludovic Court`es Date: Tue, 16 Jan 2007 17:09:48 +0000 Subject: 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 --- src/guile/skribilo/engine/latex.scm | 23 +++++++++++++++++++++-- 1 file 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 ;;; ;;; ;;; 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 -- cgit v1.2.3