added the scribble/lncs language
original commit: a1217107b26359a13f642798570c4f7a2efb2303
This commit is contained in:
parent
8111a22e06
commit
c06213e9c7
|
@ -2,23 +2,39 @@
|
||||||
(require scribble/doclang
|
(require scribble/doclang
|
||||||
scribble/core
|
scribble/core
|
||||||
(except-in scribble/base author)
|
(except-in scribble/base author)
|
||||||
|
(prefix-in s/b: scribble/base)
|
||||||
scribble/decode
|
scribble/decode
|
||||||
"../private/defaults.ss"
|
"../private/defaults.ss"
|
||||||
(for-syntax racket/base racket/list)
|
(for-syntax racket/base racket/list)
|
||||||
setup/main-collects
|
setup/main-collects
|
||||||
scribble/html-properties
|
scribble/html-properties
|
||||||
scribble/latex-properties)
|
scribble/latex-properties
|
||||||
|
racket/stxparam
|
||||||
|
(for-syntax racket/stxparam-exptime
|
||||||
|
racket/base
|
||||||
|
setup/dirs))
|
||||||
|
|
||||||
(provide (except-out (all-from-out scribble/doclang) #%module-begin)
|
(provide (except-out (all-from-out scribble/doclang) #%module-begin)
|
||||||
(all-from-out scribble/base)
|
(all-from-out scribble/base)
|
||||||
(rename-out [module-begin #%module-begin])
|
(rename-out [module-begin #%module-begin])
|
||||||
abstract include-abstract
|
abstract include-abstract
|
||||||
authors author
|
authors author
|
||||||
affiliation affiliation-mark affiliation-sep
|
institute institutes
|
||||||
maketitle)
|
email)
|
||||||
|
|
||||||
;; No options, currently, but keep in case we want to support some:
|
|
||||||
(define-syntax (module-begin stx)
|
(define-syntax (module-begin stx)
|
||||||
|
(unless (file-exists? (collection-file-path "llncs.cls" "scribble" "lncs"))
|
||||||
|
(define cd (find-collects-dir))
|
||||||
|
(raise-syntax-error 'scribble/lncs
|
||||||
|
(format "Please download the llncs.cls file (in llncs2e.zip) and put it in this directory:\n ~a~a"
|
||||||
|
(build-path (find-user-collects-dir)
|
||||||
|
"scribble" "lncs")
|
||||||
|
(if cd
|
||||||
|
(format "\nor in this one:\n ~a"
|
||||||
|
(build-path cd "scribble" "lncs"))
|
||||||
|
""))
|
||||||
|
#f))
|
||||||
|
;; No options, currently, but keep in case we want to support some:
|
||||||
(syntax-case* stx () (lambda (a b) (eq? (syntax-e a) (syntax-e b)))
|
(syntax-case* stx () (lambda (a b) (eq? (syntax-e a) (syntax-e b)))
|
||||||
[(_ id ws . body)
|
[(_ id ws . body)
|
||||||
;; Skip intraline whitespace to find options:
|
;; Skip intraline whitespace to find options:
|
||||||
|
@ -30,14 +46,12 @@
|
||||||
|
|
||||||
(define ((post-process) doc)
|
(define ((post-process) doc)
|
||||||
(add-defaults doc
|
(add-defaults doc
|
||||||
(string->bytes/utf-8
|
(string->bytes/utf-8 "\\documentclass{llncs}\n")
|
||||||
"\\documentclass{llncs}\n") ; (format "\\documentclass{llncs}\n\\usepackage{times}\n\\usepackage{qcourier}\n"))
|
|
||||||
(scribble-file "lncs/style.tex")
|
(scribble-file "lncs/style.tex")
|
||||||
(list (scribble-file "lncs/llncs.cls"))
|
(list (scribble-file "lncs/llncs.cls"))
|
||||||
#f))
|
#f))
|
||||||
|
|
||||||
|
(define lncs-extras
|
||||||
(define jfp-extras
|
|
||||||
(let ([abs (lambda (s)
|
(let ([abs (lambda (s)
|
||||||
(path->main-collects-relative
|
(path->main-collects-relative
|
||||||
(collection-file-path s "scribble" "lncs")))])
|
(collection-file-path s "scribble" "lncs")))])
|
||||||
|
@ -48,7 +62,7 @@
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
;; Abstracts:
|
;; Abstracts:
|
||||||
|
|
||||||
(define abstract-style (make-style "abstract" jfp-extras))
|
(define abstract-style (make-style "abstract" lncs-extras))
|
||||||
|
|
||||||
(define (abstract . strs)
|
(define (abstract . strs)
|
||||||
(make-nested-flow
|
(make-nested-flow
|
||||||
|
@ -77,31 +91,56 @@
|
||||||
(define-syntax (authors stx)
|
(define-syntax (authors stx)
|
||||||
(syntax-case stx (author)
|
(syntax-case stx (author)
|
||||||
[(_ (author . args) ...)
|
[(_ (author . args) ...)
|
||||||
#`(make-element (style "author" '())
|
#`(paragraph
|
||||||
(decode-content
|
(style 'author '())
|
||||||
(list
|
(make-element (style "LNCSauthor" lncs-extras)
|
||||||
#,@(apply
|
(decode-content
|
||||||
append
|
(list
|
||||||
(add-between
|
#,@(apply
|
||||||
(for/list ([stx (in-list (syntax->list #'(args ...)))])
|
append
|
||||||
(syntax-case stx ()
|
(add-between
|
||||||
[(#:inst string rest ...)
|
(for/list ([stx (in-list (syntax->list #'(args ...)))])
|
||||||
(append (syntax->list #'(rest ...))
|
(syntax-case stx ()
|
||||||
(list #'(element (style "inst" '()) (decode-content (list string)))))]
|
[(#:inst string rest ...)
|
||||||
[(rest ...)
|
(append (syntax->list #'(rest ...))
|
||||||
(syntax->list #'(rest ...))]))
|
(list #'(element (style "LNCSinst" lncs-extras) (decode-content (list string)))))]
|
||||||
(list #'(element (style "and" '()) '())))))))]
|
[(rest ...)
|
||||||
|
(syntax->list #'(rest ...))]))
|
||||||
|
(list #'(element (style "LNCSand" lncs-extras) '()))))))))]
|
||||||
[(_ . rest)
|
[(_ . rest)
|
||||||
(raise-syntax-error 'authors "expected a sequence of authors" stx)]))
|
(raise-syntax-error 'authors "expected a sequence of authors" stx)]))
|
||||||
|
|
||||||
(define (maketitle)
|
|
||||||
(element (style "maketitle" jfp-extras) '()))
|
|
||||||
|
|
||||||
(define (affiliation . txt)
|
(define-syntax-parameter email-ok #f)
|
||||||
(make-element (make-style "Affiliation" jfp-extras) (decode-content txt)))
|
|
||||||
|
|
||||||
(define (affiliation-mark . txt)
|
(define-syntax (institute stx)
|
||||||
(make-element (make-style "MarkSuperscript" jfp-extras) (decode-content txt)))
|
(raise-syntax-error #f "can only be used inside 'institutes'" stx))
|
||||||
|
(define-syntax (institutes stx)
|
||||||
|
(syntax-case stx (author)
|
||||||
|
[(_ (inst . args) ...)
|
||||||
|
#`(syntax-parameterize
|
||||||
|
((email-ok #t))
|
||||||
|
(paragraph
|
||||||
|
(style 'author '())
|
||||||
|
(make-element (style "LNCSinstitutes" lncs-extras)
|
||||||
|
(decode-content
|
||||||
|
(list
|
||||||
|
#,@(apply
|
||||||
|
append
|
||||||
|
(add-between
|
||||||
|
(for/list ([stx (in-list (syntax->list #'(args ...)))])
|
||||||
|
(syntax-case stx ()
|
||||||
|
[(rest ...)
|
||||||
|
(syntax->list #'(rest ...))]))
|
||||||
|
(list #'(element (style "LNCSand" lncs-extras) '())))))))))]
|
||||||
|
[(_ . rest)
|
||||||
|
(raise-syntax-error 'institutes "expected a sequence of institutes" stx)]))
|
||||||
|
|
||||||
(define (affiliation-sep)
|
(define-syntax (email stx)
|
||||||
(hspace 2))
|
(syntax-case stx ()
|
||||||
|
[(_ . args)
|
||||||
|
(begin
|
||||||
|
(unless (syntax-parameter-value #'email-ok)
|
||||||
|
(raise-syntax-error 'email "email can appear inside institutes only"))
|
||||||
|
#'(make-element (style "LNCSemail" lncs-extras)
|
||||||
|
(decode-content (list . args))))]))
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
\newcommand{\LNCSand}{\and}
|
||||||
|
|
||||||
|
\newcommand{\LNCSauthor}[1]{\author{#1}}
|
||||||
|
\newcommand{\LNCSinst}[1]{\inst{#1}}
|
||||||
|
|
||||||
|
\newcommand{\LNCSinstitutes}[1]{\institute{#1}}
|
||||||
|
\newcommand{\LNCSinstitute}[1]{#1}
|
||||||
|
|
||||||
|
\newcommand{\LNCSemail}[1]{\email{#1}}
|
||||||
|
|
||||||
|
\renewcommand{\SAuthorSep}{}
|
|
@ -162,8 +162,8 @@ otherwise.
|
||||||
[style any/c]
|
[style any/c]
|
||||||
[content content?])]{
|
[content content?])]{
|
||||||
|
|
||||||
See @racket[decode] and @racket[decode-part]. The @racket[tag-prefix]
|
See @racket[decode] and @racket[decode-part]. The @racket[_tag-prefix]
|
||||||
and @racket[style] fields are propagated to the resulting
|
and @racket[_style] fields are propagated to the resulting
|
||||||
@racket[part].
|
@racket[part].
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,5 @@
|
||||||
@include-section["manual-stub.scrbl"]
|
@include-section["manual-stub.scrbl"]
|
||||||
@include-section["sigplan.scrbl"]
|
@include-section["sigplan.scrbl"]
|
||||||
@include-section["jfp.scrbl"]
|
@include-section["jfp.scrbl"]
|
||||||
|
@include-section["lncs.scrbl"]
|
||||||
|
|
||||||
|
|
57
collects/scribblings/scribble/lncs.scrbl
Normal file
57
collects/scribblings/scribble/lncs.scrbl
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
#lang scribble/manual
|
||||||
|
@(require (except-in "utils.ss" author)
|
||||||
|
(for-label scribble/lncs))
|
||||||
|
|
||||||
|
@(define-syntax-rule (def base-author)
|
||||||
|
(begin
|
||||||
|
(require (for-label scribble/base))
|
||||||
|
(define base-author @racket[author])))
|
||||||
|
@(def base-author)
|
||||||
|
|
||||||
|
@title{LNCS Paper Format}
|
||||||
|
|
||||||
|
@defmodulelang[scribble/lncs #:use-sources (scribble/lncs/lang)]{
|
||||||
|
The @racketmodname[scribble/lncs]
|
||||||
|
language is like @racketmodname[scribble/manual], but configured with
|
||||||
|
Latex style defaults to use the @filepath{llncs.cls} class
|
||||||
|
file.
|
||||||
|
|
||||||
|
The class file must be downloaded from Springer and installed
|
||||||
|
into the @racket[scribble/lncs] collection directory. (Run a module
|
||||||
|
in the language @racketmodname[scribble/lncs] to learn the precise paths
|
||||||
|
where the file may go.)
|
||||||
|
}
|
||||||
|
|
||||||
|
@defproc[(abstract [pre-content pre-content?] ...) block?]{
|
||||||
|
|
||||||
|
Generates a @tech{nested flow} for a paper abstract.}
|
||||||
|
|
||||||
|
@defform[(include-abstract module-path)]{
|
||||||
|
|
||||||
|
Similar to @racket[include-section], but incorporates the document in the
|
||||||
|
specified module as an abstract. The document must have no title or
|
||||||
|
sub-parts.}
|
||||||
|
|
||||||
|
@defform/subs[(authors auth ...)
|
||||||
|
([auth (author pre-content-expr ...)
|
||||||
|
(author #:inst str-expr pre-content-expr ...)])
|
||||||
|
#:contracts ([pre-content-expr pre-content?]
|
||||||
|
[str-expr string?])]{
|
||||||
|
|
||||||
|
A replacement for @base-author from @racketmodname[scribble/base].
|
||||||
|
|
||||||
|
The @racket[#:inst] should be a number that matches up to one of the
|
||||||
|
arguments to @racket[institutes].
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@defform[(institutes (institute pre-content-expr ...) ...)
|
||||||
|
#:contracts ([pre-content-expr pre-content?])]{
|
||||||
|
|
||||||
|
The @racket[pre-content-expr]s are used as the institutions of the authors.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@defform[(email pre-content-expr ...)]{
|
||||||
|
Specifies an email address; must be used inside @racket[institute].
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user