diff --git a/.gitignore b/.gitignore index a9a9f332ee..3404d3db37 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,7 @@ compiled/ .DS_Store *.bak TAGS + +# generated docs +scribble-doc/scribblings/scribble/doc/ +scribble-doc/scriblib/scribblings/doc/ diff --git a/README.md b/README.md index 9fb6de03f8..e8e5e29d33 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ Contribute to Racket by submitting a [pull request], reporting an [issue], joining the [development mailing list], or visiting the IRC or Slack channels. +See the [Guide] for details on building. + ### License Racket, including these packages, is free software, see [LICENSE.txt] @@ -30,4 +32,5 @@ is licensed under the [Apache 2.0] license and the [MIT] license. [pull request]: https://github.com/racket/scribble/pulls [issue]: https://github.com/racket/scribble/issues [development mailing list]: https://lists.racket-lang.org +[Guide]: (https://docs.racket-lang.org/racket-build-guide/contribute.html#(part._pkg-contribute)) [LICENSE.txt]: LICENSE.txt diff --git a/scribble-doc/scribblings/scribble/acmart.scrbl b/scribble-doc/scribblings/scribble/acmart.scrbl index f343f0e6e4..fbd4fbbd88 100644 --- a/scribble-doc/scribblings/scribble/acmart.scrbl +++ b/scribble-doc/scribblings/scribble/acmart.scrbl @@ -15,14 +15,23 @@ Machinery.} @margin-note{@tt{acmart} documentation: @link["https://portalparts.acm.org/hippo/latex_templates/acmart.pdf"]{[link]}} @bold{Note:} a @racketmodname[scribble/acmart] document must include a -@racket[title] and @racket[author]. +@racket[title] and at least one @racket[author], +with an affilitation that includes at least institution and country. Example: @verbatim[#:indent 2]|{ - #lang scribble/acmart + #lang scribble/acmart @sigplan @authorversion @10pt @title{Surreal Numbers} - @author{Ursula N. Owens} + @author["Ursula N. Owens" + #:affiliation + (affiliation #:institution "Subreal Numerologists" + #:city "R'lyeh" #:country "THEM") + #:email "uno@subreal.rlyeh"] + @author["Djorge U. Oruel" + #:affiliation + (affiliation #:institution "" #:country "") + #:email "duo@minitru.oceania"] }| @deftogether[( @@ -35,9 +44,8 @@ Example: @defidform[sigplan] @defidform[sigchi] @defidform[sigchi-a] -@defidform[dtrap] -@defidform[tiot] -@defidform[tdsci] +@defidform[acmengage] +@defidform[acmcp] )]{ Enables the given document format. Use the format only on the same @@ -168,6 +176,13 @@ Specifies a subtitle.} (listof affiliation?) #f) #f] + [#:additional-affiliation additional-affiliation + (or/c pre-content? + affiliation? + (listof pre-content?) + (listof affiliation?) + #f) + #f] [#:email email (or/c pre-content? email? (listof email?)) '()] @@ -175,7 +190,7 @@ Specifies a subtitle.} block?]{ Specifies an author with an optional email address, affiliation, and/or orcid. - + @codeblock|{ #lang scribble/acmart @title{Title} @@ -194,6 +209,7 @@ Specifies a subtitle.} @deftogether[( @defproc[(acmJournal [journal pre-content?] ...) block?] @defproc[(acmConference [name pre-content?] [date pre-content?] [venue pre-content?]) block?] +@defproc[(acmBooktitle [title pre-content?]) block?] @defproc[(acmVolume [content pre-content?] ...) block?] @defproc[(acmNumber [content pre-content?] ...) block?] @defproc[(acmArticle [content pre-content?] ...) block?] @@ -203,9 +219,13 @@ Specifies a subtitle.} @defproc[(acmPrice [content pre-content?] ...) block?] @defproc[(acmISBN [content pre-content?] ...) block?] @defproc[(acmDOI [content pre-content?] ...) block?] +@defproc[(editor [name pre-content?] ...) block?] )]{ -Declares information that is collected into the front-matter region of the paper.} +Declares information that is collected into the front-matter region of the paper. + +Some of these procedures accept an empty string as argument to disable the corresponding message. +} @deftogether[( @defproc[(acmBadgeL [#:url url string? #f] [graphics string?]) block?] @@ -233,11 +253,11 @@ screen version of the image links to the badge authority. } @defproc[(email? [email any/c]) boolean?]{ - + Returns @racket[#t] if @racket[email] is an @racket[email], @racket[#f] otherwise. } - + @defproc[(affiliation [#:position position (or/c pre-content? #f) #f] @@ -248,24 +268,31 @@ screen version of the image links to the badge authority. [#:postcode postcode (or/c pre-content? #f) #f] [#:country country (or/c pre-content? #f) #f]) affiliation?]{ - + Creates an @racket[affiliation?] object for use with @racket[author]. + + As of acmart v2.05, the ACM insists that you should include + a city (or it issues a LaTeX warning) + and especially a country (or it issues a LaTeX error). + You may explicitly provide an empty string to eschew this error + without declaring a country when this might not make sense in your situation: + @racket[(affiliation #:institution "Apatrides United" #:country "")] } @defproc[(affiliation? [aff any/c]) boolean?]{ - + Returns @racket[#t] if @racket[aff] is an @racket[affiliation], @racket[#f] otherwise. } -@defproc[(institution [#:departments departments (or/c pre-content? institution? (listof institution)) '()] - [inst institution?] ...) +@defproc[(institution [#:departments departments (listof (or/c pre-content? institution?)) '()] + [pre-content?] ...) institution?]{ Creates an @racket[institution?] object for use in @racket[author].} @defproc[(institution? [inst any/c]) boolean]{ - + Returns @racket[#t] if @racket[inst] is an @racket[institution], @racket[#f] otherwise. } diff --git a/scribble-lib/scribble/acmart.rkt b/scribble-lib/scribble/acmart.rkt index 2b080131e3..eddb123914 100644 --- a/scribble-lib/scribble/acmart.rkt +++ b/scribble-lib/scribble/acmart.rkt @@ -28,6 +28,16 @@ #:name author-institution #:transparent) +(struct authornote (text) + #:constructor-name author-note + #:name author-note + #:transparent) + +(struct authornotemark (text) + #:constructor-name author-note-mark + #:name author-note-mark + #:transparent) + (provide/contract [title (->* () (#:short pre-content? @@ -39,61 +49,60 @@ #:rest (listof pre-content?) title-decl?)] [author (->* () - (#:orcid (or/c pre-content? #f) + (#:note (or/c pre-content? + authornote? + authornotemark? + (listof (or/c authornote? authornotemark?)) + #f) + #:orcid (or/c pre-content? #f) #:affiliation (or/c pre-content? affiliation? (listof affiliation?) #f) + #:additional-affiliation (or/c pre-content? + affiliation? + (listof affiliation?) + #f) #:email (or/c pre-content? email? (listof email?))) #:rest (listof pre-content?) block?)] - [authorsaddresses (->* () - () - #:rest (listof pre-content?) - block?)] - [shortauthors (->* () - () - #:rest (listof pre-content?) - element?)] + [authornote? (-> any/c boolean?)] + [authornotemark? (-> any/c boolean?)] + [authorsaddresses (->* () () #:rest (listof pre-content?) block?)] + [shortauthors (->* () () #:rest (listof pre-content?) element?)] [institution (->* () (#:departments (listof (or/c pre-content? institution?))) #:rest pre-content? institution?)] [institution? (-> any/c boolean?)] - [email (->* () - #:rest (listof pre-content?) - email?)] - [email-string (->* () - #:rest (listof string?) - email?)] + [email (->* () #:rest (listof pre-content?) email?)] + [email-string (->* () #:rest (listof string?) email?)] [email? (-> any/c boolean?)] - [affiliation (->* () + [affiliation (->* (#:institution (or/c pre-content? institution? (listof institution?) #f) + #:country (or/c pre-content? #f)) (#:position (or/c pre-content? #f) - #:institution (or/c pre-content? institution? (listof institution?) #f) #:street-address (or/c pre-content? #f) #:city (or/c pre-content? #f) #:state (or/c pre-content? #f) - #:postcode (or/c pre-content? #f) - #:country (or/c pre-content? #f)) + #:postcode (or/c pre-content? #f)) affiliation?)] [affiliation? (-> any/c boolean?)] - [abstract - (->* () () #:rest (listof pre-content?) - block?)] - [acmConference - (-> string? string? string? block?)] - [grantsponsor - (-> string? string? string? content?)] - [grantnum - (->* (string? string?) (#:url string?) content?)] + [abstract (->* () () #:rest (listof pre-content?) block?)] + [acmConference (-> string? string? string? block?)] + [grantsponsor (-> string? string? string? content?)] + [grantnum (->* (string? string?) (#:url string?) content?)] [acmBadgeR (->* (string?) (#:url string?) block?)] [acmBadgeL (->* (string?) (#:url string?) block?)] [received (->* (string?) (#:stage string?) block?)] [citestyle (-> content? block?)] [ccsdesc (->* (string?) (#:number exact-integer?) block?)] - [CCSXML - (->* () () #:rest (listof pre-content?) - any/c)]) + [CCSXML (->* () () #:rest (listof pre-content?) any/c)] + [setengagemetadata (-> string? string? block?)] + [translated-title (->* (string?) () #:rest (listof pre-content?) block?)] + [translated-subtitle (->* (string?) () #:rest (listof pre-content?) block?)] + [translated-abstract (->* (string?) () #:rest (listof pre-content?) block?)] + [anon (->* () (#:substitute (or/c pre-content? #f)) #:rest (listof pre-content?) block?)]) + (provide invisible-element-to-collect-for-acmart-extras include-abstract) @@ -106,16 +115,18 @@ ... (provide name ...))) +(define-syntax-rule (define-command name style) + (begin + (provide/contract [name (->* () () #:rest (listof pre-content?) + block?)]) + (define (name . str) + (make-paragraph (make-style 'pretitle '()) + (make-element (make-style (symbol->string 'name) command-props) + (decode-content str)))))) + (define-syntax-rule (define-commands name ...) (begin - (begin - (provide/contract [name (->* () () #:rest (listof pre-content?) - block?)]) - (define (name . str) - (make-paragraph (make-style 'pretitle '()) - (make-element (make-style (symbol->string 'name) command-props) - (decode-content str))))) - ...)) + (define-command name name) ...)) (define-syntax-rule (define-environments name ...) (begin @@ -142,7 +153,7 @@ ; format options (defopts manuscript acmsmall acmlarge acmtog sigconf siggraph sigplan sigchi sigchi-a - dtrap pacmcgit tiot tdsci) + acmengage acmcp) ; boolean options (defopts review screen natbib anonymous authorversion nonacm timestamp authordraft acmthm balance pbalance urlbreakonhyphens 9pt 10pt 11pt 12pt) @@ -216,7 +227,7 @@ (decode-string str))) (make-element (make-style "acmBadgeR" (cons 'exact-chars command-props)) (decode-string str))))) - + (define (acmBadgeL #:url [url #f] str) (make-paragraph (make-style 'pretitle '()) (if url @@ -274,45 +285,46 @@ s) content))) -(define (author #:orcid [orcid #f] +(define (author #:note [note #f] + #:orcid [orcid #f] #:affiliation [affiliation '()] + #:additional-affiliation [additional-affiliation '()] #:email [email '()] . name) (make-paragraph (make-style 'author command-props) (decode-content (list - (make-multiarg-element (make-style "SAuthorinfo" multicommand-props) - (list (make-element #f (decode-content name)) - (make-element #f - (if orcid - (make-element - (make-style "SAuthorOrcid" (cons 'exact-chars multicommand-props)) - ;; not decoding, since we want exact chars - orcid) - '())) - (make-element #f - (cond - [(affiliation? affiliation) - (convert-affiliation affiliation)] - [(pre-content? affiliation) - (make-element - (make-style "SAuthorPlace" multicommand-props) - (decode-content (list affiliation)))] - [else - (for/list ([a (in-list affiliation)]) - (convert-affiliation a))])) - (make-element #f - (cond - [(email? email) - (convert-email email)] - [(pre-content? email) - (make-element - (make-style "SAuthorEmail" multicommand-props) - (decode-content (list email)))] - [else - (for/list ([e (in-list email)]) - (convert-email e))])))))))) + (make-multiarg-element + (make-style "SAuthorinfo" multicommand-props) + (list (make-element #f (decode-content name)) + (map + (lambda (n) + (cond ((authornote? n) (make-element "authornote" (authornote-text n))) + ((authornotemark? n) (make-element "SAuthorNoteMark" (authornotemark-text n)))) + (cond ((not note) '()) + ((list? note) note) + (else (list note))))) + (make-element #f + (if orcid + (make-element + (make-style "SAuthorOrcid" (cons 'exact-chars multicommand-props)) + ;; not decoding, since we want exact chars + orcid) + '())) + (make-affiliation affiliation "SAuthorAffiliation") + (make-affiliation additional-affiliation "SAuthorAdditionalAffiliation") + (make-element #f + (cond + [(email? email) + (convert-email email)] + [(pre-content? email) + (make-element + (make-style "SAuthorEmail" multicommand-props) + (decode-content (list email)))] + [else + (for/list ([e (in-list email)]) + (convert-email e))]))))))))0 (define (authorsaddresses . content) (make-paragraph @@ -328,6 +340,12 @@ . name) (author-institution name departments)) +(define (authornote . content) + (author-note (decode-content content))) + +(define (authornotemark (number #f)) + (author-note-mark number)) + (define (convert-institution inst #:department? [department? #f]) (define level 0) @@ -402,14 +420,18 @@ #:city [city #f] #:state [state #f] #:postcode [postcode #f] - #:country [country #f]) + #:country [country ""]) (author-affiliation position institution street-address city state postcode country)) -(define (convert-affiliation aff) +(define (make-element* str content) + (make-element str (decode-content (list content)))) + +(define (convert-affiliation aff style) (define (maybe-element str content) - (and (content aff) (make-element str (decode-content (list (content aff)))))) + (let ([c (content aff)]) + (and c (make-element* str c)))) (make-element - (make-style "SAuthorPlace" command-props) + (make-style style command-props) (make-multiarg-element (make-style #f multicommand-props) (filter values @@ -421,14 +443,29 @@ (maybe-element "city" affiliation-city) (maybe-element "state" affiliation-state) (maybe-element "postcode" affiliation-postcode) - (maybe-element "country" affiliation-country))))))) - -(define-commands subtitle acmJournal - thanks titlenote subtitlenote authornote acmVolume acmNumber acmArticle acmYear acmMonth - acmArticleSeq acmPrice acmISBN acmDOI + (make-element* "country" (affiliation-country affiliation)))))))) + +(define (make-affiliation affiliation style) + (make-element #f + (cond + [(affiliation? affiliation) + (convert-affiliation affiliation style)] + [(pre-content? affiliation) + (make-element + (make-style style multicommand-props) + (decode-content (list affiliation)))] + [else + (for/list ([a (in-list affiliation)]) + (convert-affiliation a style))]))) + +(define-commands subtitle acmJournal acmBooktitle editor + thanks titlenote subtitlenote acmVolume acmNumber acmArticle acmYear acmMonth + acmArticleSeq acmPrice acmISBN acmDOI acmSubmissionID startPage terms keywords - setcopyright copyrightyear - settopmatter hortauthors) + setcopyright copyrightyear setcctype + settopmatter hortauthors + acmArticleType acmCodeLink acmDataLink + setcitestyle) (define (CCSXML . strs) (make-nested-flow (make-style "CCSXML" '()) @@ -436,6 +473,31 @@ (make-element (make-style #f '(exact-chars)) (apply string-append strs)))))) +(define (setengagemetadata name value) + (make-paragraph (make-style 'pretitle '()) + (make-multiarg-element (make-style "setengagemetadata" multicommand-props) + (list (decode-string name) + (decode-string value))))) +(define ((translated-content style) language . title) + (make-paragraph (make-style 'pretitle '()) + (make-multiarg-element (make-style style multicommand-props) + (list (decode-string language) + (decode-content title))))) +(define translated-title (translated-content "translatedtitle")) +(define translated-subtitle (translated-content "translatedsubtitle")) +(define (translated-abstract language . strs) + ;; gross hack + (make-nested-flow + (make-style (string-append "translatedabstract}{" language) (cons 'pretitle acmart-extras)) + (decode-flow strs))) + +(define (anon #:substitute (substitute #f) . rest) + (if substitute + (make-element "anon" (decode-content rest)) + (make-element* (make-style "SAnon" multicommand-props) + (list (decode-string substitute) + (decode-content rest))))) + (define-environments teaserfigure sidebar marginfigure margintable) (define-comment-environments printonly screenonly anonsuppress acks) diff --git a/scribble-lib/scribble/acmart/style.tex b/scribble-lib/scribble/acmart/style.tex index 4d5a4d4a35..3a48ed5c7b 100644 --- a/scribble-lib/scribble/acmart/style.tex +++ b/scribble-lib/scribble/acmart/style.tex @@ -23,8 +23,10 @@ \renewcommand{\SAuthorinfo}[4]{\author{#1}{#2}{#3}{#4}} \renewcommand{\SAuthorSep}[1]{} \renewcommand{\SAuthorOrcid}[1]{\orcid{#1}} -\renewcommand{\SAuthorPlace}[1]{\affiliation{#1}} +\renewcommand{\SAuthorAffiliation}[1]{\affiliation{#1}} +\renewcommand{\SAuthorAdditionalAffiliation}[1]{\additionalaffiliation{#1}} \renewcommand{\SAuthorEmail}[1]{\email{#1}} +\renewcommand{\SAuthorNoteMark}[1]{\authornotemark[#1]} \renewcommand{\SConferenceInfo}[2]{\conferenceinfo{#1}{#2}} \renewcommand{\SCopyrightYear}[1]{\copyrightyear{#1}} @@ -49,5 +51,7 @@ \newcommand{\SreceivedStage}[2]{\received[#1]{#2}} \newcommand{\SccsdescNumber}[2]{\ccsdesc[#1]{#2}} + +\newcommand{\SAnon}[2]{\anon[#1]{#2}} % END acmart/style.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%