diff --git a/scribble-doc/scribblings/scribble/acmart.scrbl b/scribble-doc/scribblings/scribble/acmart.scrbl index babb08a8..fca73465 100644 --- a/scribble-doc/scribblings/scribble/acmart.scrbl +++ b/scribble-doc/scribblings/scribble/acmart.scrbl @@ -34,6 +34,9 @@ Example: @defidform[sigplan] @defidform[sigchi] @defidform[sigchi-a] +@defidform[dtrap] +@defidform[tiot] +@defidform[tdsci] )]{ Enables the given document format. Use the format only on the same diff --git a/scribble-lib/scribble/acmart.rkt b/scribble-lib/scribble/acmart.rkt index 8ef217cf..80416d02 100644 --- a/scribble-lib/scribble/acmart.rkt +++ b/scribble-lib/scribble/acmart.rkt @@ -9,6 +9,7 @@ scribble/html-properties scribble/latex-properties scribble/private/tag + scribble/private/lang-parameters (for-syntax racket/base)) (struct affiliation (position institution street-address city state postcode country) @@ -132,7 +133,8 @@ ...)) ; format options -(defopts manuscript acmsmall acmlarge acmtog sigconf siggraph sigplan sigchi sigchi-a) +(defopts manuscript acmsmall acmlarge acmtog sigconf siggraph sigplan sigchi sigchi-a + dtrap pacmcgit tiot tdsci) ; boolean options (defopts review screen natbib anonymous authorversion 9pt 10pt 11pt 12pt) @@ -407,3 +409,7 @@ ; FIXME: theorem styles +(default-figure-label-text (make-element 'sf "Fig.")) +(default-figure-label-sep ". ") +(default-figure-caption-style 'sf) +(default-figure-counter-style 'sf) diff --git a/scribble-lib/scribble/acmart/acmart.cls b/scribble-lib/scribble/acmart/acmart.cls index 987e3c41..7b360a98 100644 --- a/scribble-lib/scribble/acmart/acmart.cls +++ b/scribble-lib/scribble/acmart/acmart.cls @@ -37,7 +37,7 @@ %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{acmart} -[2017/09/16 v1.48 Typesetting articles for the Association for +[2018/04/14 v1.53 Typesetting articles for the Association for Computing Machinery] \def\@classname{acmart} \InputIfFileExists{acmart-preload-hook.tex}{% @@ -199,22 +199,6 @@ Computing Machinery] \ClassInfo{\@classname}{Using fontsize \ACM@fontsize} \LoadClass[\ACM@fontsize, reqno]{amsart} \RequirePackage{microtype} -\ifcase\ACM@format@nr - \relax % manuscript - \or % acmsmall - \or % acmlarge - \or % acmtog - \RequirePackage{flushend} - \or % sigconf - \RequirePackage{flushend} - \or % siggraph - \RequirePackage{flushend} - \or % sigplan - \RequirePackage{flushend} - \or % sigchi - \RequirePackage{flushend} - \or % sigchi-a -\fi \RequirePackage{etoolbox} \RequirePackage{refcount} \RequirePackage{totpages} @@ -465,7 +449,6 @@ Computing Machinery] \let\citeANP\citeauthor \let\citeNN\citeyearpar \let\citeyearNP\citeyear - \let\citeyear\citeyearpar \let\citeNP\citealt \DeclareRobustCommand\citeA {\begingroup\NAT@swafalse @@ -477,7 +460,7 @@ Computing Machinery] \providecommand\citename[1]{#1}} \fi \newcommand\shortcite[2][]{% - \ifNAT@numbers\cite[#1]{#2}\else\citeyear[#1]{#2}\fi} + \ifNAT@numbers\cite[#1]{#2}\else\citeyearpar[#1]{#2}\fi} \def\bibliographystyle#1{% \ifx\@begindocumenthook\@undefined\else \expandafter\AtBeginDocument @@ -485,7 +468,8 @@ Computing Machinery] {\if@filesw \immediate\write\@auxout{\string\bibstyle{#1}}% \fi}} -\RequirePackage{graphicx, xcolor} +\RequirePackage{graphicx} +\RequirePackage[prologue]{xcolor} \definecolor[named]{ACMBlue}{cmyk}{1,0.1,0,0.1} \definecolor[named]{ACMYellow}{cmyk}{0,0.16,1,0} \definecolor[named]{ACMOrange}{cmyk}{0,0.42,1,0.01} @@ -499,8 +483,8 @@ Computing Machinery] \SetWatermarkFontSize{0.5in} \SetWatermarkColor[gray]{.9} \SetWatermarkText{\parbox{12em}{\centering - Unpublished working draft\\ - Not for distribution}} + Unpublished working draft.\\ + Not for distribution.}} \fi \RequirePackage{geometry} \ifcase\ACM@format@nr @@ -655,10 +639,16 @@ Computing Machinery] have the newtxmath package installed. Please upgrade your TeX}\@ACM@newfontsfalse} \if@ACM@newfonts -\RequirePackage[tt=false, type1=true]{libertine} +\ifxetex + \RequirePackage[tt=false]{libertine} +\else + \RequirePackage[tt=false, type1=true]{libertine} +\fi \RequirePackage[varqu]{zi4} \RequirePackage[libertine]{newtxmath} -\RequirePackage[T1]{fontenc} +\ifxetex\else + \RequirePackage[T1]{fontenc} +\fi \fi \let\liningnums\@undefined \AtEndPreamble{% @@ -793,6 +783,7 @@ Computing Machinery] \define@choicekey*+{ACM}{acmJournal}[\@journalCode\@journalCode@nr]{% CIE,% CSUR,% + DTRAP,% IMWUT,% JACM,% JDIQ,% @@ -800,6 +791,7 @@ Computing Machinery] JERIC,% JETC,% JOCCH,% + PACMCGIT,% PACMHCI,% PACMPL,% POMACS,% @@ -810,10 +802,12 @@ Computing Machinery] TALLIP,% TAP,% TCPS,% + TDSCI,% TEAC,% TECS,% THRI,% TIIS,% + TIOT,% TISSEC,% TIST,% TKDD,% @@ -853,6 +847,10 @@ Computing Machinery] \def\@journalName{ACM Computing Surveys}% \def\@journalNameShort{ACM Comput. Surv.}% \def\@permissionCodeOne{0360-0300}% +\or % DTRAP + \def\@journalName{Digital Threats: Research and Practice}% + \def\@journalNameShort{Digit. Threat. Res. Pract.}% + \def\@permissionCodeOne{2576-5337}% \or % IMWUT \def\@journalName{Proceedings of the ACM on Interactive, Mobile, Wearable and Ubiquitous Technologies}% @@ -883,6 +881,12 @@ Computing Machinery] \or % JOCCH \def\@journalName{ACM Journal on Computing and Cultural Heritage}% \def\@journalNameShort{ACM J. Comput. Cult. Herit.}% +\or % PACMCGIT + \def\@journalName{Proceedings of the ACM on Computer Graphics and Interactive Techniques}% + \def\@journalNameShort{Proc. ACM Comput. Graph. Interact. Tech.}% + \def\@permissionCodeOne{2577-6193}% + \@ACM@screentrue + \PackageInfo{\@classname}{Using screen mode due to \@journalCode}% \or % PACMHCI \def\@journalName{Proceedings of the ACM on Human-Computer Interaction}% \def\@journalNameShort{Proc. ACM Hum.-Comput. Interact.}% @@ -924,6 +928,10 @@ Computing Machinery] \def\@journalName{ACM Transactions on Applied Perception}% \or % TCPS \def\@journalName{ACM Transactions on Cyber-Physical Systems}% +\or % TDSCI + \def\@journalName{ACM Transactions on Data Science}% + \def\@journalNameShort{ACM Trans. Data Sci.}% + \def\@permissionCodeOne{2577-3224}% \or % TEAC \def\@journalName{ACM Transactions on Economics and Computation}% \or % TECS @@ -938,6 +946,10 @@ Computing Machinery] \def\@journalName{ACM Transactions on Interactive Intelligent Systems}% \def\@journalNameShort{ACM Trans. Interact. Intell. Syst.}% \def\@permissionCodeOne{2160-6455}% +\or % TIOT + \def\@journalName{ACM Transactions on Internet of Things}% + \def\@journalNameShort{ACM Trans. Internet Things}% + \def\@permissionCodeOne{2577-6207}% \or % TISSEC \def\@journalName{ACM Transactions on Information and System Security}% \def\@journalNameShort{ACM Trans. Info. Syst. Sec.}% @@ -1332,7 +1344,8 @@ Computing Machinery] \acm@copyrightinput\acm@copyrightmode]{none,% acmcopyright,acmlicensed,rightsretained,% usgov,usgovmixed,cagov,cagovmixed,licensedusgovmixed,% - licensedcagov,licensedcagovmixed,othergov,licensedothergov}{% + licensedcagov,licensedcagovmixed,othergov,licensedothergov,% + iw3c2w3,iw3c2w3g}{% \@printpermissiontrue \@printcopyrighttrue \@acmownedtrue @@ -1346,13 +1359,13 @@ Computing Machinery] \fi \ifnum\acm@copyrightmode=3\relax % rightsretained \@acmownedfalse - \acmPrice{}% + \AtBeginDocument{\acmPrice{}}% \fi \ifnum\acm@copyrightmode=4\relax % usgov \@printpermissiontrue \@printcopyrightfalse \@acmownedfalse - \acmPrice{}% + \AtBeginDocument{\acmPrice{}}% \fi \ifnum\acm@copyrightmode=6\relax % cagov \@acmownedfalse @@ -1371,6 +1384,14 @@ Computing Machinery] \fi \ifnum\acm@copyrightmode=12\relax % licensedothergov \@acmownedfalse + \fi + \ifnum\acm@copyrightmode=13\relax % iw3c2w3 + \@acmownedfalse + \AtBeginDocument{\acmPrice{}}% + \fi + \ifnum\acm@copyrightmode=14\relax % iw3c2w3g + \@acmownedfalse + \AtBeginDocument{\acmPrice{}}% \fi} \def\setcopyright#1{\setkeys{ACM@}{acmcopyrightmode=#1}} \setcopyright{acmcopyright} @@ -1380,7 +1401,7 @@ Computing Machinery] Association for Computing Machinery. \or % acmlicensed Copyright held by the owner/author(s). Publication rights licensed to - Association for Computing Machinery. + ACM\@. \or % rightsretained Copyright held by the owner/author(s). \or % usgov @@ -1392,18 +1413,24 @@ Computing Machinery] Association for Computing Machinery. \or %licensedusgovmixed Copyright held by the owner/author(s). Publication rights licensed to - Association for Computing Machinery. + ACM\@. \or % licensedcagov Crown in Right of Canada. Publication rights licensed to - Association for Computing Machinery. + ACM\@. \or %licensedcagovmixed Copyright held by the owner/author(s). Publication rights licensed to - Association for Computing Machinery. + ACM\@. \or % othergov Association for Computing Machinery. \or % licensedothergov Copyright held by the owner/author(s). Publication rights licensed to - Association for Computing Machinery. + ACM\@. + \or % ic2w3www + IW3C2 (International World Wide Web Conference Committee), published + under Creative Commons CC-BY~4.0 License. + \or % ic2w3wwwgoogle + IW3C2 (International World Wide Web Conference Committee), published + under Creative Commons CC-BY-NC-ND~4.0 License. \fi} \def\@formatdoi#1{\url{https://doi.org/#1}} \def\@copyrightpermission{% @@ -1517,7 +1544,18 @@ Computing Machinery] retains a nonexclusive, royalty-free right to publish or reproduce this article, or to allow others to do so, for Government purposes only. - \fi} + \or % iw3c2w3 + This paper is published under the Creative Commons Attribution~4.0 + International (CC-BY~4.0) license. Authors reserve their rights to + disseminate the work on their personal and corporate Web sites with + the appropriate attribution. + \or % iw3c2w3g + This paper is published under the Creative Commons + Attribution-NonCommercial-NoDerivs~4.0 International + (CC-BY-NC-ND~4.0) license. Authors reserve their rights to + disseminate the work on their personal and corporate Web sites with + the appropriate attribution. + \fi} \def\copyrightyear#1{\def\@copyrightyear{#1}} \copyrightyear{\@acmYear} \def\@teaserfigures{} @@ -1571,8 +1609,7 @@ Computing Machinery] \footnotetextcopyrightpermission{% \if@ACM@authordraft \raisebox{-2ex}[\z@][\z@]{\makebox[0pt][l]{\large\bfseries - Unpublished - working draft. Not for distribution}}% + Unpublished working draft. Not for distribution.}}% \color[gray]{0.9}% \fi \parindent\z@\parskip0.1\baselineskip @@ -1642,10 +1679,17 @@ Computing Machinery] \if@ACM@printacmref \@mkbibcitation \fi - \hypersetup{pdfauthor={\authors}, + \hypersetup{% + pdflang={English}, + pdfdisplaydoctitle, + pdfauthor={\authors}, pdftitle={\@title}, pdfsubject={\@concepts}, - pdfkeywords={\@keywords}}% + pdfkeywords={\@keywords}, + pdfcreator={LaTeX with acmart + \csname ver@acmart.cls\endcsname\space + and hyperref + \csname ver@hyperref.sty\endcsname}}% \@printendtopmatter \@afterindentfalse \@afterheading @@ -2119,7 +2163,7 @@ Computing Machinery] ACM, New York, NY, USA% \@article@string\unskip, \ref{TotPages}~\@pages@word. \fi - \@formatdoi{\@acmDOI} + \ifx\@acmDOI\@empty\else\@formatdoi{\@acmDOI}\fi \par\egroup} \def\@printendtopmatter{\par\bigskip} \def\@setthanks{\long\def\thanks##1{\par##1\@addpunct.}\thankses} @@ -2189,7 +2233,7 @@ Computing Machinery] \fancyhead[RO]{\@headfootfont\@acmArticle\if@ACM@printfolios:\thepage\fi}% \fancyhead[RE]{\@headfootfont\@shortauthors}% \fancyhead[LO]{\ACM@linecountL\@headfootfont\shorttitle}% - \fancyfoot[RO,LE]{\footnotesize \@journalName, Vol. \@acmVolume, No. + \fancyfoot[RO,LE]{\footnotesize \@journalNameShort, Vol. \@acmVolume, No. \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% \or % acmlarge \fancyhead[LE]{\ACM@linecountL\@headfootfont @@ -2197,7 +2241,7 @@ Computing Machinery] \fancyhead[LO]{\ACM@linecountL}% \fancyhead[RO]{\@headfootfont \shorttitle\quad\textbullet\quad\@acmArticle\if@ACM@printfolios:\thepage\fi}% - \fancyfoot[RO,LE]{\footnotesize \@journalName, Vol. \@acmVolume, No. + \fancyfoot[RO,LE]{\footnotesize \@journalNameShort, Vol. \@acmVolume, No. \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% \or % acmtog \fancyhead[LE]{\ACM@linecountL\@headfootfont @@ -2206,7 +2250,7 @@ Computing Machinery] \fancyhead[RE]{\ACM@linecountR}% \fancyhead[RO]{\@headfootfont \shorttitle\quad\textbullet\quad\@acmArticle\if@ACM@printfolios:\thepage\fi\ACM@linecountR}% - \fancyfoot[RO,LE]{\footnotesize \@journalName, Vol. \@acmVolume, No. + \fancyfoot[RO,LE]{\footnotesize \@journalNameShort, Vol. \@acmVolume, No. \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% \else % Proceedings \fancyfoot[C]{\if@ACM@printfolios\footnotesize\thepage\fi}% @@ -2275,7 +2319,7 @@ Computing Machinery] \fancyfoot[RO,LE]{\if@ACM@printfolios\small\thepage\fi}% \fancyfoot[RE,LO]{\footnotesize Manuscript submitted to ACM}% \or % acmsmall - \fancyfoot[RO,LE]{\footnotesize \@journalName, Vol. \@acmVolume, No. + \fancyfoot[RO,LE]{\footnotesize \@journalNameShort, Vol. \@acmVolume, No. \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% \fancyhead[LE]{\ACM@linecountL\@folioblob}% @@ -2283,7 +2327,7 @@ Computing Machinery] \fancyhead[RO]{\@folioblob}% \fancyheadoffset[RO,LE]{0.6\@folio@wd}% \or % acmlarge - \fancyfoot[RO,LE]{\footnotesize \@journalName, Vol. \@acmVolume, No. + \fancyfoot[RO,LE]{\footnotesize \@journalNameShort, Vol. \@acmVolume, No. \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% \fancyhead[RO]{\@folioblob}% @@ -2291,7 +2335,7 @@ Computing Machinery] \fancyhead[LO]{\ACM@linecountL}% \fancyheadoffset[RO,LE]{1.4\@folio@wd}% \or % acmtog - \fancyfoot[RO,LE]{\footnotesize \@journalName, Vol. \@acmVolume, No. + \fancyfoot[RO,LE]{\footnotesize \@journalNameShort, Vol. \@acmVolume, No. \@acmNumber, Article \@acmArticle. Publication date: \@acmPubDate.}% \fancyhead[L]{\ACM@linecountL}% @@ -2465,8 +2509,9 @@ Computing Machinery] \@ifundefined{proposition}{% \newtheorem{proposition}[theorem]{Proposition} }{} + \@ifundefined{lemma}{% \newtheorem{lemma}[theorem]{Lemma} - \@ifundefined{lemma}{}{} + }{} \@ifundefined{corollary}{% \newtheorem{corollary}[theorem]{Corollary} }{} diff --git a/scribble-lib/scribble/acmart/lang.rkt b/scribble-lib/scribble/acmart/lang.rkt index e8755f50..80708a12 100644 --- a/scribble-lib/scribble/acmart/lang.rkt +++ b/scribble-lib/scribble/acmart/lang.rkt @@ -6,7 +6,8 @@ scribble/latex-prefix racket/list "../private/defaults.rkt" - (for-syntax racket/base)) + (for-syntax racket/base + syntax/parse)) (provide (except-out (all-from-out scribble/doclang) #%module-begin) (all-from-out scribble/acmart) (all-from-out scribble/base) @@ -23,106 +24,98 @@ [authorversion? #f] [font-size #f]) (let loop ([stuff #'body]) - (syntax-case* stuff (manuscript acmsmall acmlarge acmtog sigconf siggraph sigplan sigchi sigchi-a - review screen natbib anonymous authorversion 9pt 10pt 11pt 12pt) - (lambda (a b) (eq? (syntax-e a) (syntax-e b))) + (syntax-parse stuff + #:datum-literals (manuscript acmsmall acmlarge acmtog sigconf siggraph sigplan sigchi + sigchi-a dtrap pacmcgit tiot tdsci review screen natbib + anonymous authorversion 9pt 10pt 11pt 12pt) + + ;; Skip intraline whitespace to find options: [(ws . body) - ;; Skip intraline whitespace to find options: - (and (string? (syntax-e #'ws)) - (regexp-match? #rx"^ *$" (syntax-e #'ws))) + #:when (and (string? (syntax-e #'ws)) + (regexp-match? #rx"^ *$" (syntax-e #'ws))) (loop #'body)] - ; boolean options - [((review #t) . body) - (set! review? "review=true") - (loop #'body)] - [((review #f) . body) - (set! review? "review=false") - (loop #'body)] - [(review . body) - (set! review? "review=true") - (loop #'body)] - [((screen #t) . body) - (set! screen? "screen=true") - (loop #'body)] - [((screen #f) . body) - (set! screen? "screen=false") - (loop #'body)] - [(screen . body) - (set! screen? "screen=true") - (loop #'body)] - [((natbib #t) . body) - (set! natbib? "natbib=true") - (loop #'body)] - [((natbib #f) . body) - (set! natbib? "natbib=false") - (loop #'body)] - [(natbib . body) - (set! natbib? "natbib=true") - (loop #'body)] + ; boolean options + [((review #t) . body) + (set! review? "review=true") + (loop #'body)] + [((review #f) . body) + (set! review? "review=false") + (loop #'body)] + [(review . body) + (set! review? "review=true") + (loop #'body)] + [((screen #t) . body) + (set! screen? "screen=true") + (loop #'body)] + [((screen #f) . body) + (set! screen? "screen=false") + (loop #'body)] + [(screen . body) + (set! screen? "screen=true") + (loop #'body)] + [((natbib #t) . body) + (set! natbib? "natbib=true") + (loop #'body)] + [((natbib #f) . body) + (set! natbib? "natbib=false") + (loop #'body)] + [(natbib . body) + (set! natbib? "natbib=true") + (loop #'body)] - [((anonymous #t) . body) - (set! anonymous? "anonymous=true") - (loop #'body)] - [((anonymous #f) . body) - (set! anonymous? "anonymous=false") - (loop #'body)] - [(anonymous . body) - (set! anonymous? "anonymous=true") - (loop #'body)] - [((authorversion #t) . body) - (set! authorversion? "authorversion=true") - (loop #'body)] - [((authorversion #f) . body) - (set! authorversion? "authorversion=false") - (loop #'body)] - [(authorversion . body) - (set! authorversion? "authorversion=true") - (loop #'body)] - [(9pt . body) - (set! font-size "9pt") - (loop #'body)] - [(10pt . body) - (set! font-size "10pt") - (loop #'body)] - [(11pt . body) - (set! font-size "11pt") - (loop #'body)] - [(12pt . body) - (set! font-size "12pt") - (loop #'body)] + [((anonymous #t) . body) + (set! anonymous? "anonymous=true") + (loop #'body)] + [((anonymous #f) . body) + (set! anonymous? "anonymous=false") + (loop #'body)] + [(anonymous . body) + (set! anonymous? "anonymous=true") + (loop #'body)] + [((authorversion #t) . body) + (set! authorversion? "authorversion=true") + (loop #'body)] + [((authorversion #f) . body) + (set! authorversion? "authorversion=false") + (loop #'body)] + [(authorversion . body) + (set! authorversion? "authorversion=true") + (loop #'body)] + [(9pt . body) + (set! font-size "9pt") + (loop #'body)] + [(10pt . body) + (set! font-size "10pt") + (loop #'body)] + [(11pt . body) + (set! font-size "11pt") + (loop #'body)] + [(12pt . body) + (set! font-size "12pt") + (loop #'body)] ; format options - [(manuscript . body) - (set! format? "manuscript") + [((~and fmt + (~or manuscript + acmsmall + acmlarge + acmtog + sigconf + siggraph + sigplan + sigchi + sigchi-a + dtrap + pacmcgit + tiot + tdsci)) + . body) + (set! format? (symbol->string (syntax->datum #'fmt))) (loop #'body)] - [(acmsmall . body) - (set! format? "acmsmall") - (loop #'body)] - [(acmlarge . body) - (set! format? "acmlarge") - (loop #'body)] - [(acmtog . body) - (set! format? "acmtog") - (loop #'body)] - [(sigconf . body) - (set! format? "sigconf") - (loop #'body)] - [(sigconf . body) - (set! format? "siggraph") - (loop #'body)] - [(sigplan . body) - (set! format? "sigplan") - (loop #'body)] - [(sigchi . body) - (set! format? "sigchi") - (loop #'body)] - [(sigchi-a . body) - (set! format? "sigchi-a") - (loop #'body)] - - [body + + [body #`(#%module-begin id (post-process #,review? #,screen? #,natbib? #,anonymous? #,authorversion? #,font-size #,format?) () . body)])))])) (define ((post-process . opts) doc) @@ -139,7 +132,7 @@ (scribble-file "acmart/style.tex") (list (scribble-file "acmart/acmart.cls")) #f - #:replacements (hash "scribble-load-replace.tex" (scribble-file "acmart/acmart-load.tex")))))) + #:replacements (hash "scribble-load-replace.tex" (scribble-file "acmart/acmart-load.tex")))))) (define (add-acmart-styles doc) (struct-copy part doc diff --git a/scribble-lib/scribble/private/lang-parameters.rkt b/scribble-lib/scribble/private/lang-parameters.rkt new file mode 100644 index 00000000..dc4686cf --- /dev/null +++ b/scribble-lib/scribble/private/lang-parameters.rkt @@ -0,0 +1,19 @@ +#lang racket/base + +(provide (all-defined-out)) + +;; Some latex formats have different requirements on how +;; figures, citations, etc. are displayed. This allows different +;; scribble langs to handle them. + +;; `Figure` string that appears in front of a figure caption +(define default-figure-label-text (make-parameter "Figure")) + +;; Seperator string between figure counter and caption +(define default-figure-label-sep (make-parameter ": ")) + +;; Style for the figure caption +(define default-figure-caption-style (make-parameter #f)) + +;; Style for the number in the figure counter +(define default-figure-counter-style (make-parameter #f)) diff --git a/scribble-lib/scriblib/figure.rkt b/scribble-lib/scriblib/figure.rkt index 968637b4..eb4de48b 100644 --- a/scribble-lib/scriblib/figure.rkt +++ b/scribble-lib/scriblib/figure.rkt @@ -6,7 +6,8 @@ scribble/html-properties scribble/latex-properties setup/main-collects - "private/counter.rkt") + "private/counter.rkt" + scribble/private/lang-parameters) (provide figure figure* @@ -75,11 +76,9 @@ figure-style-extras)) c)) -(define default-label-sep ": ") - (define (figure tag caption #:style [style center-figure-style] - #:label-sep [label-sep default-label-sep] + #:label-sep [label-sep (default-figure-label-sep)] #:label-style [label-style #f] #:continue? [continue? #f] . content) @@ -87,7 +86,7 @@ (define (figure-here tag caption #:style [style center-figure-style] - #:label-sep [label-sep default-label-sep] + #:label-sep [label-sep (default-figure-label-sep)] #:label-style [label-style #f] #:continue? [continue? #f] . content) @@ -95,14 +94,14 @@ (define (figure* tag caption #:style [style center-figure-style] - #:label-sep [label-sep default-label-sep] + #:label-sep [label-sep (default-figure-label-sep)] #:label-style [label-style #f] #:continue? [continue? #f] . content) (figure-helper figuremulti-style style label-sep label-style tag caption content continue?)) (define (figure** tag caption #:style [style center-figure-style] - #:label-sep [label-sep default-label-sep] + #:label-sep [label-sep (default-figure-label-sep)] #:label-style [label-style #f] #:continue? [continue? #f] . content) @@ -124,7 +123,7 @@ #:label-sep label-sep #:label-style label-style #:continue? continue?) - caption))))))) + (make-element (default-figure-caption-style) caption)))))))) (define figures (new-counter "figure" #:target-wrap make-figure-target @@ -134,7 +133,7 @@ #:label-sep [label-sep ": "] #:label-style [label-style #f]) (counter-target figures tag - "Figure" + (default-figure-label-text) #:label-suffix (list (if continue? " (continued)" "") label-sep) #:label-style label-style #:target-style figure-target-style diff --git a/scribble-lib/scriblib/private/counter.rkt b/scribble-lib/scriblib/private/counter.rkt index 35dc1b52..69a3dc00 100644 --- a/scribble-lib/scriblib/private/counter.rkt +++ b/scribble-lib/scriblib/private/counter.rkt @@ -1,6 +1,7 @@ #lang racket/base (require scribble/core - scribble/decode) + scribble/decode + scribble/private/lang-parameters) (provide new-counter counter-target @@ -38,7 +39,8 @@ (let ([n (resolve-get part ri (tag->counter-tag counter tag "value"))]) (cons (make-element label-style - (let ([l (cons (format "~a" n) (decode-content (list label-suffix)))]) + (let ([l (cons (make-element (default-figure-counter-style) (format "~a" n)) + (decode-content (list label-suffix)))]) (if label (list* label 'nbsp l) l)))