commit 2e3bc1ec9577a5164db03585f2cf8ebcfe986ba1
parent 1035eb35d84701079d4d060e4651d580910a80c6
Author: Robby Findler <robby@racket-lang.org>
Date: Sun, 21 Mar 2010 22:56:26 +0000
added support for the 10pt option to the sigplan scribble support
svn: r18593
original commit: c74849dc2ef14865b450995ed251f4fc8fc61dcb
Diffstat:
3 files changed, 53 insertions(+), 19 deletions(-)
diff --git a/collects/scribble/sigplan.ss b/collects/scribble/sigplan.ss
@@ -7,7 +7,7 @@
scribble/latex-properties
(for-syntax scheme/base))
-(provide preprint
+(provide preprint 10pt
abstract include-abstract
authorinfo
conferenceinfo copyrightyear copyrightdata
@@ -17,6 +17,10 @@
(raise-syntax-error #f
"option must appear on the same line as `#lang scribble/sigplan'"
stx))
+(define-syntax (10pt stx)
+ (raise-syntax-error #f
+ "option must appear on the same line as `#lang scribble/sigplan'"
+ stx))
(define sigplan-extras
(let ([abs (lambda (s)
diff --git a/collects/scribble/sigplan/lang.ss b/collects/scribble/sigplan/lang.ss
@@ -12,26 +12,42 @@
(rename-out [module-begin #%module-begin]))
(define-syntax (module-begin stx)
- (syntax-case* stx (preprint) (lambda (a b) (eq? (syntax-e a) (syntax-e b)))
- [(_ id ws . body)
- ;; Skip intraline whitespace to find options:
- (and (string? (syntax-e #'ws))
- (regexp-match? #rx"^ *$" (syntax-e #'ws)))
- #'(module-begin id . body)]
- [(_ id preprint . body)
- #'(#%module-begin id (post-process #t) () . body)]
+ (syntax-case stx ()
[(_ id . body)
- #'(#%module-begin id (post-process #f) () . 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:
+ (and (string? (syntax-e #'ws))
+ (regexp-match? #rx"^ *$" (syntax-e #'ws)))
+ (loop #'body)]
+ [(preprint . body)
+ (set! preprint? #t)
+ (loop #'body)]
+ [(10pt . body)
+ (set! 10pt? #t)
+ (loop #'body)]
+ [body
+ #`(#%module-begin id (post-process #,preprint? #,10pt?) () . body)])))]))
-(define ((post-process preprint?) doc)
- (add-sigplan-styles
- (add-defaults doc
- (string->bytes/utf-8
- (format "\\documentclass~a{sigplanconf}\n\\usepackage{times}\n\\usepackage{qcourier}\n"
- (if preprint? "[preprint]" "")))
- (scribble-file "sigplan/style.tex")
- (list (scribble-file "sigplan/sigplanconf.cls"))
- #f)))
+(define ((post-process preprint? 10pt?) doc)
+ (let ([options
+ (cond
+ [(and preprint? 10pt?) "[preprint, 10pt]"]
+ [preprint? "[preprint]"]
+ [10pt? "[10pt]"]
+ [else ""])])
+ (add-sigplan-styles
+ (add-defaults doc
+ (string->bytes/utf-8
+ (format "\\documentclass~a{sigplanconf}\n\\usepackage{times}\n\\usepackage{qcourier}\n"
+ options))
+ (scribble-file "sigplan/style.tex")
+ (list (scribble-file "sigplan/sigplanconf.cls"))
+ #f))))
(define (add-sigplan-styles doc)
;; Ensure that "sigplan.tex" is used, since "style.tex"
diff --git a/collects/scribblings/scribble/sigplan.scrbl b/collects/scribblings/scribble/sigplan.scrbl
@@ -19,6 +19,20 @@ same line as @hash-lang[], with only whitespace between
#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?]{