diff --git a/collects/scribble/jfp.ss b/collects/scribble/jfp.ss new file mode 100644 index 00000000..7db49c74 --- /dev/null +++ b/collects/scribble/jfp.ss @@ -0,0 +1,66 @@ +#lang scheme/base +(require setup/main-collects + scribble/core + (except-in scribble/base author) + scribble/decode + scribble/html-properties + scribble/latex-properties + (for-syntax scheme/base)) + +(provide abstract include-abstract + author author/short + affiliation affiliation-mark affiliation-sep) + +(define jfp-extras + (let ([abs (lambda (s) + (path->main-collects-relative + (build-path (collection-path "scribble") "jfp" s)))]) + (list + (make-css-addition (abs "jfp.css")) + (make-tex-addition (abs "jfp.tex"))))) + +;; ---------------------------------------- +;; Abstracts: + +(define abstract-style (make-style "abstract" jfp-extras)) + +(define (abstract . strs) + (make-nested-flow + abstract-style + (decode-flow strs))) + +(define (extract-abstract p) + (unless (part? p) + (error 'include-abstract "doc binding is not a part: ~e" p)) + (unless (null? (part-parts p)) + (error 'include-abstract "abstract part has sub-parts: ~e" (part-parts p))) + (when (part-title-content p) + (error 'include-abstract "abstract part has title content: ~e" (part-title-content p))) + (part-blocks p)) + +(define-syntax-rule (include-abstract mp) + (begin + (require (only-in mp [doc abstract-doc])) + (make-nested-flow abstract-style (extract-abstract abstract-doc)))) + +;; ---------------------------------------- +;; Author + +(define (author . long) + (apply (apply author/short long) long)) + +(define ((author/short . short) . long) + (make-paragraph + (make-style 'author jfp-extras) + (list + (make-multiarg-element "JFPAuthor" (list (decode-content short) + (decode-content long)))))) + +(define (affiliation . txt) + (make-element (make-style "Affiliation" jfp-extras) (decode-content txt))) + +(define (affiliation-mark . txt) + (make-element (make-style "MarkSuperscript" jfp-extras) (decode-content txt))) + +(define (affiliation-sep) + (hspace 2)) diff --git a/collects/scribble/jfp/jfp.tex b/collects/scribble/jfp/jfp.tex new file mode 100644 index 00000000..815165c0 --- /dev/null +++ b/collects/scribble/jfp/jfp.tex @@ -0,0 +1,5 @@ + +\newcommand{\Affiliation}[1]{\\ #1} +\newcommand{\MarkSuperscript}[1]{$^{#1}$} + +\newcommand{\JFPAuthor}[2]{\author[#1]{#2}} diff --git a/collects/scribble/jfp/lang.ss b/collects/scribble/jfp/lang.ss new file mode 100644 index 00000000..e5f8f67c --- /dev/null +++ b/collects/scribble/jfp/lang.ss @@ -0,0 +1,31 @@ +#lang scheme/base +(require scribble/doclang + scribble/core + (except-in scribble/base author) + scribble/decode + scribble/jfp + "../private/defaults.ss" + (for-syntax scheme/base)) +(provide (except-out (all-from-out scribble/doclang) #%module-begin) + (all-from-out scribble/jfp) + (all-from-out scribble/base) + (rename-out [module-begin #%module-begin])) + +;; No options, currently, but keep in case we want to support some: +(define-syntax (module-begin stx) + (syntax-case* stx () (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 . body) + #'(#%module-begin id (post-process) () . body)])) + +(define ((post-process) doc) + (add-defaults doc + (string->bytes/utf-8 + (format "\\documentclass{jfp}\n\\usepackage{times}\n\\usepackage{qcourier}\n")) + (scribble-file "jfp/style.tex") + (list (scribble-file "jfp/jfp.cls")) + #f)) diff --git a/collects/scribble/jfp/lang/reader.ss b/collects/scribble/jfp/lang/reader.ss new file mode 100644 index 00000000..1f0c6c29 --- /dev/null +++ b/collects/scribble/jfp/lang/reader.ss @@ -0,0 +1,15 @@ +#lang s-exp syntax/module-reader + +scribble/jfp/lang + +#:read scribble:read-inside +#:read-syntax scribble:read-syntax-inside +#:whole-body-readers? #t +#:wrapper1 (lambda (t) (cons 'doc (t))) +#:info (lambda (key defval default) + (case key + [(color-lexer) + (dynamic-require 'syntax-color/scribble-lexer 'scribble-inside-lexer)] + [else (default key defval)])) + +(require (prefix-in scribble: "../../reader.ss")) diff --git a/collects/scribble/jfp/style.tex b/collects/scribble/jfp/style.tex new file mode 100644 index 00000000..09d7c156 --- /dev/null +++ b/collects/scribble/jfp/style.tex @@ -0,0 +1,3 @@ + +\renewcommand{\titleAndVersionAndAuthors}[3]{\title[#2]{#1}#3\maketitle} +\renewcommand{\titleAndEmptyVersionAndAuthors}[3]{\titleAndVersionAndAuthors{#1}{#1}{#3}} diff --git a/collects/scribblings/scribble/generic.scrbl b/collects/scribblings/scribble/generic.scrbl index 7b47bcb2..d192ea9b 100644 --- a/collects/scribblings/scribble/generic.scrbl +++ b/collects/scribblings/scribble/generic.scrbl @@ -8,3 +8,5 @@ @include-section["base.scrbl"] @include-section["manual-stub.scrbl"] @include-section["sigplan.scrbl"] +@include-section["jfp.scrbl"] + diff --git a/collects/scribblings/scribble/jfp.scrbl b/collects/scribblings/scribble/jfp.scrbl new file mode 100644 index 00000000..15424cd4 --- /dev/null +++ b/collects/scribblings/scribble/jfp.scrbl @@ -0,0 +1,55 @@ +#lang scribble/manual +@(require (except-in "utils.ss" author) + (for-label scribble/jfp)) + +@(define-syntax-rule (def base-author) + (begin + (require (for-label scribble/base)) + (define base-author @scheme[author]))) +@(def base-author) + +@title{JFP Paper Format} + +@defmodulelang[scribble/jfp]{The @schememodname[scribble/jfp] +language is like @schememodname[scribble/manual], but configured with +Latex style defaults to use the @filepath{jfp.cls} class +file that is included with Scribble.} + +Latex output with @schememodname[scribble/jfp] uses a main-document +version supplied to @scheme[title] as the short-form document name (to +be used in page headers). + +@defproc[(abstract [pre-content pre-content?] ...) block?]{ + +Generates a @tech{nested flow} for a paper abstract.} + +@defform[(include-abstract module-path)]{ + +Similar to @scheme[include-section], but incorporates the document in the +specified module as an abstract. The document must have no title or +sub-parts.} + +@defproc[(author [name pre-content?] ...) + block?]{ + +A replacement for @base-author from @schememodname[scribble/base].} + +@defproc[((author/short [short-name pre-content?] ...) [long-name pre-content?] ...) + block?]{ + +Like @scheme[author], but allows the short-form names (to be used in +page headers) to be specified separately from the long-form name.} + +@deftogether[( +@defproc[(affiliation [place pre-content?] ...) element?] +@defproc[(affiliation-mark [mark pre-content?] ...) element?] +@defproc[(affiliation-sep) element?] +)]{ + +Use @scheme[affiliation] within @scheme[author] or the long-name part +of @scheme[author/short] to specify affiliations after all authors. +If different authors have different affiliations, use +@scheme[affiliation-mark] with a number after each author, and then +use @scheme[affiliation-mark] before each different affiliation within +a single @scheme[affiliation], using @scheme[(affiliation-sep)] to +separate affiliations.} diff --git a/collects/scribblings/scribble/sigplan.scrbl b/collects/scribblings/scribble/sigplan.scrbl index 5ec0aa9a..2867b8bd 100644 --- a/collects/scribblings/scribble/sigplan.scrbl +++ b/collects/scribblings/scribble/sigplan.scrbl @@ -26,7 +26,7 @@ Generates a @tech{nested flow} for a paper abstract.} @defform[(include-abstract module-path)]{ -Similar to @scheme[include-path], but incorporates the document in the +Similar to @scheme[include-section], but incorporates the document in the specified module as an abstract. The document must have no title or sub-parts.} diff --git a/collects/scribblings/scribble/struct.scrbl b/collects/scribblings/scribble/struct.scrbl index aeabe54a..fa34ef3e 100644 --- a/collects/scribblings/scribble/struct.scrbl +++ b/collects/scribblings/scribble/struct.scrbl @@ -118,7 +118,7 @@ coerced to one. @deftogether[( -@defproc[(make-styled-paragraph [style any/c][content list?]) paragraph?] +@defproc[(make-styled-paragraph [content list?][style any/c]) paragraph?] @defproc[(styled-paragraph? [v any/c]) boolean?] @defproc[(styled-paragraph-style [p paragraph?]) style?] )]{