commit 871a61581ce86f5de17c6bfa7d8affbbacb76833
parent 835ef02800144de31b4c95829aaf6c57e9d6f184
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Tue, 19 Feb 2013 11:20:29 -0700
scribble/sigplan: add `subtitle'
Based on David Van Horn's suggestion.
Also, make both `author' and `authorinfo' work (even when mixed).
original commit: c9c4d33a2f93cac296c43d0ba04663a870d31664
Diffstat:
5 files changed, 45 insertions(+), 5 deletions(-)
diff --git a/collects/scribble/sigplan.rkt b/collects/scribble/sigplan.rkt
@@ -12,6 +12,9 @@
[abstract
(->* () () #:rest (listof pre-content?)
block?)]
+ [subtitle
+ (->* () () #:rest (listof pre-content?)
+ content?)]
[authorinfo
(-> pre-content? pre-content? pre-content?
block?)]
@@ -83,9 +86,12 @@
;; Authors and conference info:
(define (authorinfo name affiliation e-mail)
+ ;; The \SAuthor macro in "style.tex" looks specifically
+ ;; for an \SAuthorinfo as its argument, and handles it
+ ;; specially in that case:
(author
(make-multiarg-element
- (make-style "SAuthorinfo"sigplan-extras)
+ (make-style "SAuthorinfo" sigplan-extras)
(list
(make-element #f (decode-content (list name)))
(make-element (make-style "SAuthorPlace" sigplan-extras)
@@ -93,6 +99,10 @@
(make-element (make-style "SAuthorEmail" sigplan-extras)
(decode-content (list e-mail)))))))
+(define (subtitle . str)
+ (make-element (make-style "SSubtitle" (append '(aux) sigplan-extras))
+ (decode-content str)))
+
(define (conferenceinfo what where)
(make-paragraph
(make-style 'pretitle null)
diff --git a/collects/scribble/sigplan/sigplan.css b/collects/scribble/sigplan/sigplan.css
@@ -6,3 +6,8 @@
.SCategory, .SCategoryPlus, .STerms, .SKeywords {
display: none;
}
+
+.SSubtitle {
+ display: block;
+ font-size: smaller;
+}
+\ No newline at end of file
diff --git a/collects/scribble/sigplan/sigplan.tex b/collects/scribble/sigplan/sigplan.tex
@@ -16,3 +16,6 @@
\newcommand{\SCategoryPlus}[4]{}
\newcommand{\STerms}[1]{}
\newcommand{\SKeywords}[1]{}
+
+% Normally gets re-written by the title macro:
+\newcommand{\SSubtitle}[1]{{\bf #1}}
diff --git a/collects/scribble/sigplan/style.tex b/collects/scribble/sigplan/style.tex
@@ -1,11 +1,28 @@
-\renewcommand{\titleAndVersionAndAuthors}[3]{\title{#1}#3\maketitle}
+% Define \SXtitle to lift \SSubtitle out:
+\def\SXtitle#1{\title{\let\SSubtitle\SSubtitleDrop#1}\SExtractSubtitle#1\SExtractSubtitleDone}
+\def\SSubtitleDrop#1{}
+\def\SExtractSubtitleDone {}
+\def\SExtractSubtitle{\futurelet\next\SExtractSubtitleX}
+\def\SExtractSubtitleX#1{\ifx#1\SSubtitle \let\Snext\SWithSubtitle \else \let\Snext\SExtractSubtitleY \fi \Snext}
+\def\SExtractSubtitleY{\ifx\next\SExtractSubtitleDone \let\Snext\relax \else \let\Snext\SExtractSubtitle \fi \Snext}
+\def\SWithSubtitle#1{\subtitle{#1}\SExtractSubtitle}
+
+\renewcommand{\titleAndVersionAndAuthors}[3]{\SXtitle{#1}#3\maketitle}
\renewcommand{\titleAndEmptyVersionAndAuthors}[3]{\titleAndVersionAndAuthors{#1}{#2}{#3}}
-\renewcommand{\titleAndVersionAndEmptyAuthors}[3]{\title{#1}\authorinfo{Anonymous}{}{}\maketitle}
+\renewcommand{\titleAndVersionAndEmptyAuthors}[3]{\SXtitle{#1}\authorinfo{Anonymous}{}{}\maketitle}
\renewcommand{\titleAndEmptyVersionAndEmptyAuthors}[3]{\titleAndVersionAndEmptyAuthors{#1}{#2}{#3}}
-% Disable plain `author', enable `authorinfo:'
-\renewcommand{\SAuthor}[1]{#1}
+% Support plain `author' while enabling `authorinfo': for each
+% use of \SAuthor, check whether it contains an \SAuthorinfo form:
+\def\SAuthor#1{\SAutoAuthor#1\SAutoAuthorDone{#1}}
+\def\SAutoAuthorDone#1{}
+\def\SAutoAuthor{\futurelet\next\SAutoAuthorX}
+\def\SAutoAuthorX{\ifx\next\SAuthorinfo \let\Snext\relax \else \let\Snext\SToAuthorDone \fi \Snext}
+\def\SToAuthorDone{\futurelet\next\SToAuthorDoneX}
+\def\SToAuthorDoneX#1{\ifx\next\SAutoAuthorDone \let\Snext\SAddAuthorInfo \else \let\Snext\SToAuthorDone \fi \Snext}
+\newcommand{\SAddAuthorInfo}[1]{\authorinfo{#1}{}{}}
+
\renewcommand{\SAuthorinfo}[3]{\authorinfo{#1}{#2}{#3}}
\renewcommand{\SAuthorSep}[1]{}
diff --git a/collects/scribblings/scribble/sigplan.scrbl b/collects/scribblings/scribble/sigplan.scrbl
@@ -87,6 +87,10 @@ 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.}
+@defproc[(subtitle [pre-content pre-content?] ...) element?]{
+
+Use as the last argument to @racket[title] to specify a subtitle.}
+
@defproc[(authorinfo [name pre-content?]
[affiliation pre-content?]
[email pre-content?])