added support for the 10pt option to the sigplan scribble support

svn: r18593
This commit is contained in:
Robby Findler 2010-03-21 22:56:26 +00:00
parent 40444fc087
commit c74849dc2e
3 changed files with 53 additions and 19 deletions

View File

@ -7,7 +7,7 @@
scribble/latex-properties scribble/latex-properties
(for-syntax scheme/base)) (for-syntax scheme/base))
(provide preprint (provide preprint 10pt
abstract include-abstract abstract include-abstract
authorinfo authorinfo
conferenceinfo copyrightyear copyrightdata conferenceinfo copyrightyear copyrightdata
@ -17,6 +17,10 @@
(raise-syntax-error #f (raise-syntax-error #f
"option must appear on the same line as `#lang scribble/sigplan'" "option must appear on the same line as `#lang scribble/sigplan'"
stx)) stx))
(define-syntax (10pt stx)
(raise-syntax-error #f
"option must appear on the same line as `#lang scribble/sigplan'"
stx))
(define sigplan-extras (define sigplan-extras
(let ([abs (lambda (s) (let ([abs (lambda (s)

View File

@ -12,26 +12,42 @@
(rename-out [module-begin #%module-begin])) (rename-out [module-begin #%module-begin]))
(define-syntax (module-begin stx) (define-syntax (module-begin stx)
(syntax-case* stx (preprint) (lambda (a b) (eq? (syntax-e a) (syntax-e b))) (syntax-case stx ()
[(_ id ws . body) [(_ id . body)
(printf "body: ~s\n" #'body)
(let ([preprint? #f]
[10pt? #f])
(let loop ([stuff #'body])
(syntax-case* stuff (preprint 10pt) (lambda (a b) (eq? (syntax-e a) (syntax-e b)))
[(ws . body)
;; Skip intraline whitespace to find options: ;; Skip intraline whitespace to find options:
(and (string? (syntax-e #'ws)) (and (string? (syntax-e #'ws))
(regexp-match? #rx"^ *$" (syntax-e #'ws))) (regexp-match? #rx"^ *$" (syntax-e #'ws)))
#'(module-begin id . body)] (loop #'body)]
[(_ id preprint . body) [(preprint . body)
#'(#%module-begin id (post-process #t) () . body)] (set! preprint? #t)
[(_ id . body) (loop #'body)]
#'(#%module-begin id (post-process #f) () . body)])) [(10pt . body)
(set! 10pt? #t)
(loop #'body)]
[body
#`(#%module-begin id (post-process #,preprint? #,10pt?) () . body)])))]))
(define ((post-process preprint?) doc) (define ((post-process preprint? 10pt?) doc)
(let ([options
(cond
[(and preprint? 10pt?) "[preprint, 10pt]"]
[preprint? "[preprint]"]
[10pt? "[10pt]"]
[else ""])])
(add-sigplan-styles (add-sigplan-styles
(add-defaults doc (add-defaults doc
(string->bytes/utf-8 (string->bytes/utf-8
(format "\\documentclass~a{sigplanconf}\n\\usepackage{times}\n\\usepackage{qcourier}\n" (format "\\documentclass~a{sigplanconf}\n\\usepackage{times}\n\\usepackage{qcourier}\n"
(if preprint? "[preprint]" ""))) options))
(scribble-file "sigplan/style.tex") (scribble-file "sigplan/style.tex")
(list (scribble-file "sigplan/sigplanconf.cls")) (list (scribble-file "sigplan/sigplanconf.cls"))
#f))) #f))))
(define (add-sigplan-styles doc) (define (add-sigplan-styles doc)
;; Ensure that "sigplan.tex" is used, since "style.tex" ;; Ensure that "sigplan.tex" is used, since "style.tex"

View File

@ -19,6 +19,20 @@ same line as @hash-lang[], with only whitespace between
#lang scribble/sigplan @preprint #lang scribble/sigplan @preprint
}|} }|}
@defidform[10pt]{
Enables the @tt{10pt} option. Use @scheme[10pt] only on the
same line as @hash-lang[], with only whitespace between
@schememodname[scribble/sigplan] and @scheme[10pt]:
@verbatim[#:indent 2]|{
#lang scribble/sigplan @10pt
}|
The @scheme[10pt] and @scheme[preprint] options can be
used together and may appear in any order.
}
@defproc[(abstract [pre-content pre-content?] ...) block?]{ @defproc[(abstract [pre-content pre-content?] ...) block?]{