adjusted scribble's sigplan setup so that the times.sty and qcourier.sty packages can be disabled.

original commit: 747c735eb323dd99f98c7049b4bb358e9d8f00d1
This commit is contained in:
Robby Findler 2010-11-19 17:50:52 -06:00
parent 2e87b2f353
commit e30aedf47f
3 changed files with 63 additions and 16 deletions

View File

@ -35,7 +35,7 @@
(->* () () #:rest (listof pre-content?) (->* () () #:rest (listof pre-content?)
content?)]) content?)])
(provide preprint 10pt nocopyright onecolumn (provide preprint 10pt nocopyright onecolumn noqcourier notimes
include-abstract) include-abstract)
(define-syntax-rule (defopts name ...) (define-syntax-rule (defopts name ...)
@ -45,7 +45,7 @@
stx)) stx))
... ...
(provide name ...))) (provide name ...)))
(defopts preprint 10pt nocopyright onecolumn) (defopts preprint 10pt nocopyright onecolumn noqcourier notimes)
(define sigplan-extras (define sigplan-extras
(let ([abs (lambda (s) (let ([abs (lambda (s)

View File

@ -18,9 +18,11 @@
(let ([preprint? #f] (let ([preprint? #f]
[10pt? #f] [10pt? #f]
[onecolumn? #f] [onecolumn? #f]
[nocopyright? #f]) [nocopyright? #f]
[times? #t]
[qcourier? #t])
(let loop ([stuff #'body]) (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) [(ws . body)
;; Skip intraline whitespace to find options: ;; Skip intraline whitespace to find options:
(and (string? (syntax-e #'ws)) (and (string? (syntax-e #'ws))
@ -38,19 +40,41 @@
[(10pt . body) [(10pt . body)
(set! 10pt? "10pt") (set! 10pt? "10pt")
(loop #'body)] (loop #'body)]
[(noqcourier . body)
(set! qcourier? #f)
(loop #'body)]
[(notimes . body)
(set! times? #f)
(loop #'body)]
[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) The docs for the times.sty package suggests that it should not be used
(let ([options 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) (if (ormap values opts)
(format "[~a]" (apply string-append (add-between (filter values opts) ", "))) (format "[~a]" (apply string-append (add-between (filter values opts) ", ")))
"")]) "")])
(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~a~a"
options)) options
(if times?
"\\usepackage{times}\n"
"")
(if qcourier?
"\\usepackage{qcourier}\n"
"")))
(scribble-file "sigplan/style.tex") (scribble-file "sigplan/style.tex")
(list (scribble-file "sigplan/sigplanconf.cls")) (list (scribble-file "sigplan/sigplanconf.cls"))
#f)))) #f))))

View File

@ -12,7 +12,7 @@ file that is included with Scribble.}
@defidform[preprint]{ @defidform[preprint]{
Enables the @tt{preprint} option. Use @racket[preprint] only on the 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]: @racketmodname[scribble/sigplan] and @racket[preprint]:
@verbatim[#:indent 2]|{ @verbatim[#:indent 2]|{
@ -22,7 +22,7 @@ same line as @hash-lang[], with only whitespace between
@defidform[10pt]{ @defidform[10pt]{
Enables the @tt{10pt} option. Use @racket[10pt] only on the 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]: @racketmodname[scribble/sigplan] and @racket[10pt]:
@verbatim[#:indent 2]|{ @verbatim[#:indent 2]|{
@ -32,7 +32,7 @@ same line as @hash-lang[], with only whitespace between
@defidform[nocopyright]{ @defidform[nocopyright]{
Enables the @tt{nocopyright} option. Use @racket[nocopyright] only on the 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]: @racketmodname[scribble/sigplan] and @racket[nocopyright]:
@verbatim[#:indent 2]|{ @verbatim[#:indent 2]|{
@ -42,16 +42,39 @@ same line as @hash-lang[], with only whitespace between
@defidform[onecolumn]{ @defidform[onecolumn]{
Enables the @tt{onecolumn} option. Use @racket[onecolumn] only on the 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]: @racketmodname[scribble/sigplan] and @racket[onecolumn]:
@codeblock|{ @codeblock|{
#lang scribble/sigplan @onecolumn #lang scribble/sigplan @onecolumn
}|} }|}
The @racket[10pt], @racket[preprint], @racket[nocopyright], and
@racket[onecolumn] options can be used together and may appear in any @defidform[notimes]{
order.
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.
} }