From e30aedf47fcaae928fc99bc4e44a216a96a3376e Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 19 Nov 2010 17:50:52 -0600 Subject: [PATCH] adjusted scribble's sigplan setup so that the times.sty and qcourier.sty packages can be disabled. original commit: 747c735eb323dd99f98c7049b4bb358e9d8f00d1 --- collects/scribble/sigplan.rkt | 4 +-- collects/scribble/sigplan/lang.rkt | 38 +++++++++++++++++---- collects/scribblings/scribble/sigplan.scrbl | 37 ++++++++++++++++---- 3 files changed, 63 insertions(+), 16 deletions(-) diff --git a/collects/scribble/sigplan.rkt b/collects/scribble/sigplan.rkt index a144ac29..8607a800 100644 --- a/collects/scribble/sigplan.rkt +++ b/collects/scribble/sigplan.rkt @@ -35,7 +35,7 @@ (->* () () #:rest (listof pre-content?) content?)]) -(provide preprint 10pt nocopyright onecolumn +(provide preprint 10pt nocopyright onecolumn noqcourier notimes include-abstract) (define-syntax-rule (defopts name ...) @@ -45,7 +45,7 @@ stx)) ... (provide name ...))) -(defopts preprint 10pt nocopyright onecolumn) +(defopts preprint 10pt nocopyright onecolumn noqcourier notimes) (define sigplan-extras (let ([abs (lambda (s) diff --git a/collects/scribble/sigplan/lang.rkt b/collects/scribble/sigplan/lang.rkt index 4c03b3eb..bcf43a50 100644 --- a/collects/scribble/sigplan/lang.rkt +++ b/collects/scribble/sigplan/lang.rkt @@ -18,9 +18,11 @@ (let ([preprint? #f] [10pt? #f] [onecolumn? #f] - [nocopyright? #f]) + [nocopyright? #f] + [times? #t] + [qcourier? #t]) (let loop ([stuff #'body]) - (syntax-case* stuff (onecolumn preprint 10pt nocopyright) (lambda (a b) (eq? (syntax-e a) (syntax-e b))) + (syntax-case* stuff (onecolumn preprint 10pt nocopyright notimes noqcourier) (lambda (a b) (eq? (syntax-e a) (syntax-e b))) [(ws . body) ;; Skip intraline whitespace to find options: (and (string? (syntax-e #'ws)) @@ -38,19 +40,41 @@ [(10pt . body) (set! 10pt? "10pt") (loop #'body)] + [(noqcourier . body) + (set! qcourier? #f) + (loop #'body)] + [(notimes . body) + (set! times? #f) + (loop #'body)] [body - #`(#%module-begin id (post-process #,preprint? #,10pt? #,nocopyright? #,onecolumn?) () . body)])))])) + #`(#%module-begin id (post-process #,times? #,qcourier? #,preprint? #,10pt? #,nocopyright? #,onecolumn?) () . body)])))])) +#| -(define ((post-process . opts) doc) - (let ([options +The docs for the times.sty package suggests that it should not be used +so maybe we want to disable it permanently (or replace it with something else). + +Read here for more: + + http://www.ctan.org/tex-archive/macros/latex/required/psnfss/psnfss2e.pdf + +|# + +(define ((post-process times? qcourier? . opts) doc) + (let ([options (if (ormap values opts) (format "[~a]" (apply string-append (add-between (filter values opts) ", "))) "")]) (add-sigplan-styles (add-defaults doc (string->bytes/utf-8 - (format "\\documentclass~a{sigplanconf}\n\\usepackage{times}\n\\usepackage{qcourier}\n" - options)) + (format "\\documentclass~a{sigplanconf}\n~a~a" + options + (if times? + "\\usepackage{times}\n" + "") + (if qcourier? + "\\usepackage{qcourier}\n" + ""))) (scribble-file "sigplan/style.tex") (list (scribble-file "sigplan/sigplanconf.cls")) #f)))) diff --git a/collects/scribblings/scribble/sigplan.scrbl b/collects/scribblings/scribble/sigplan.scrbl index 37a206bb..bf8b2465 100644 --- a/collects/scribblings/scribble/sigplan.scrbl +++ b/collects/scribblings/scribble/sigplan.scrbl @@ -12,7 +12,7 @@ file that is included with Scribble.} @defidform[preprint]{ Enables the @tt{preprint} option. Use @racket[preprint] only on the -same line as @hash-lang[], with only whitespace between +same line as @hash-lang[], with only whitespace (or other options) between @racketmodname[scribble/sigplan] and @racket[preprint]: @verbatim[#:indent 2]|{ @@ -22,7 +22,7 @@ same line as @hash-lang[], with only whitespace between @defidform[10pt]{ Enables the @tt{10pt} option. Use @racket[10pt] only on the -same line as @hash-lang[], with only whitespace between +same line as @hash-lang[], with only whitespace (or other options) between @racketmodname[scribble/sigplan] and @racket[10pt]: @verbatim[#:indent 2]|{ @@ -32,7 +32,7 @@ same line as @hash-lang[], with only whitespace between @defidform[nocopyright]{ Enables the @tt{nocopyright} option. Use @racket[nocopyright] only on the -same line as @hash-lang[], with only whitespace between +same line as @hash-lang[], with only whitespace (or other options) between @racketmodname[scribble/sigplan] and @racket[nocopyright]: @verbatim[#:indent 2]|{ @@ -42,16 +42,39 @@ same line as @hash-lang[], with only whitespace between @defidform[onecolumn]{ Enables the @tt{onecolumn} option. Use @racket[onecolumn] only on the -same line as @hash-lang[], with only whitespace between +same line as @hash-lang[], with only whitespace (or other options) between @racketmodname[scribble/sigplan] and @racket[onecolumn]: @codeblock|{ #lang scribble/sigplan @onecolumn }|} -The @racket[10pt], @racket[preprint], @racket[nocopyright], and -@racket[onecolumn] options can be used together and may appear in any -order. + +@defidform[notimes]{ + +Disables the use of @tt{\usepackage@"{"times@"}"} in the generated LaTeX output. +Use @racket[onecolumn] only on the +same line as @hash-lang[], with only whitespace (or other options) between +@racketmodname[scribble/sigplan] and @racket[notimes]: + +@codeblock|{ + #lang scribble/sigplan @notimes +}|} + +@defidform[noqcourier]{ + +Disables the use of @tt{\usepackage@"{"qcourier@"}"} in the generated LaTeX output. +Use @racket[onecolumn] only on the +same line as @hash-lang[], with only whitespace (or other options) between +@racketmodname[scribble/sigplan] and @racket[noqcourier]: + +@codeblock|{ + #lang scribble/sigplan @noqcourier +}|} + +The @racket[10pt], @racket[preprint], @racket[nocopyright], +@racket[onecolumn], @racket[notimes], and @racket[noqcourier] +options can be used together and may appear in any order. }