added the scribble/lncs language
original commit: a1217107b26359a13f642798570c4f7a2efb2303
This commit is contained in:
parent
8111a22e06
commit
c06213e9c7
|
@ -2,23 +2,39 @@
|
|||
(require scribble/doclang
|
||||
scribble/core
|
||||
(except-in scribble/base author)
|
||||
(prefix-in s/b: scribble/base)
|
||||
scribble/decode
|
||||
"../private/defaults.ss"
|
||||
(for-syntax racket/base racket/list)
|
||||
setup/main-collects
|
||||
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)
|
||||
(all-from-out scribble/base)
|
||||
(rename-out [module-begin #%module-begin])
|
||||
abstract include-abstract
|
||||
authors author
|
||||
affiliation affiliation-mark affiliation-sep
|
||||
maketitle)
|
||||
institute institutes
|
||||
email)
|
||||
|
||||
;; No options, currently, but keep in case we want to support some:
|
||||
(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)))
|
||||
[(_ id ws . body)
|
||||
;; Skip intraline whitespace to find options:
|
||||
|
@ -30,14 +46,12 @@
|
|||
|
||||
(define ((post-process) doc)
|
||||
(add-defaults doc
|
||||
(string->bytes/utf-8
|
||||
"\\documentclass{llncs}\n") ; (format "\\documentclass{llncs}\n\\usepackage{times}\n\\usepackage{qcourier}\n"))
|
||||
(string->bytes/utf-8 "\\documentclass{llncs}\n")
|
||||
(scribble-file "lncs/style.tex")
|
||||
(list (scribble-file "lncs/llncs.cls"))
|
||||
#f))
|
||||
|
||||
|
||||
(define jfp-extras
|
||||
(define lncs-extras
|
||||
(let ([abs (lambda (s)
|
||||
(path->main-collects-relative
|
||||
(collection-file-path s "scribble" "lncs")))])
|
||||
|
@ -48,7 +62,7 @@
|
|||
;; ----------------------------------------
|
||||
;; Abstracts:
|
||||
|
||||
(define abstract-style (make-style "abstract" jfp-extras))
|
||||
(define abstract-style (make-style "abstract" lncs-extras))
|
||||
|
||||
(define (abstract . strs)
|
||||
(make-nested-flow
|
||||
|
@ -77,31 +91,56 @@
|
|||
(define-syntax (authors stx)
|
||||
(syntax-case stx (author)
|
||||
[(_ (author . args) ...)
|
||||
#`(make-element (style "author" '())
|
||||
(decode-content
|
||||
(list
|
||||
#,@(apply
|
||||
append
|
||||
(add-between
|
||||
(for/list ([stx (in-list (syntax->list #'(args ...)))])
|
||||
(syntax-case stx ()
|
||||
[(#:inst string rest ...)
|
||||
(append (syntax->list #'(rest ...))
|
||||
(list #'(element (style "inst" '()) (decode-content (list string)))))]
|
||||
[(rest ...)
|
||||
(syntax->list #'(rest ...))]))
|
||||
(list #'(element (style "and" '()) '())))))))]
|
||||
#`(paragraph
|
||||
(style 'author '())
|
||||
(make-element (style "LNCSauthor" lncs-extras)
|
||||
(decode-content
|
||||
(list
|
||||
#,@(apply
|
||||
append
|
||||
(add-between
|
||||
(for/list ([stx (in-list (syntax->list #'(args ...)))])
|
||||
(syntax-case stx ()
|
||||
[(#:inst string rest ...)
|
||||
(append (syntax->list #'(rest ...))
|
||||
(list #'(element (style "LNCSinst" lncs-extras) (decode-content (list string)))))]
|
||||
[(rest ...)
|
||||
(syntax->list #'(rest ...))]))
|
||||
(list #'(element (style "LNCSand" lncs-extras) '()))))))))]
|
||||
[(_ . rest)
|
||||
(raise-syntax-error 'authors "expected a sequence of authors" stx)]))
|
||||
|
||||
(define (maketitle)
|
||||
(element (style "maketitle" jfp-extras) '()))
|
||||
|
||||
(define (affiliation . txt)
|
||||
(make-element (make-style "Affiliation" jfp-extras) (decode-content txt)))
|
||||
(define-syntax-parameter email-ok #f)
|
||||
|
||||
(define (affiliation-mark . txt)
|
||||
(make-element (make-style "MarkSuperscript" jfp-extras) (decode-content txt)))
|
||||
(define-syntax (institute stx)
|
||||
(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)
|
||||
(hspace 2))
|
||||
(define-syntax (email stx)
|
||||
(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]
|
||||
[content content?])]{
|
||||
|
||||
See @racket[decode] and @racket[decode-part]. The @racket[tag-prefix]
|
||||
and @racket[style] fields are propagated to the resulting
|
||||
See @racket[decode] and @racket[decode-part]. The @racket[_tag-prefix]
|
||||
and @racket[_style] fields are propagated to the resulting
|
||||
@racket[part].
|
||||
|
||||
}
|
||||
|
|
|
@ -9,4 +9,5 @@
|
|||
@include-section["manual-stub.scrbl"]
|
||||
@include-section["sigplan.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