diff --git a/scribble-doc/scribblings/scribble/acmart.scrbl b/scribble-doc/scribblings/scribble/acmart.scrbl index ac0d45d9..0a39027e 100644 --- a/scribble-doc/scribblings/scribble/acmart.scrbl +++ b/scribble-doc/scribblings/scribble/acmart.scrbl @@ -239,28 +239,28 @@ defaults to @racket{Received} for the first occurrence and @received[#:stage "accepted"]{June 2009} }|} -@defproc[(teaserfigure [content pre-content?] ...) block?]{ +@defproc[(teaserfigure [content pre-flow?] ...) block?]{ Creates a teaser figure to appear before main text.} @deftogether[( -@defproc[(sidebar [content pre-content?] ...) block?] -@defproc[(marginfigure [content pre-content?] ...) block?] -@defproc[(margintable [content pre-content?] ...) block?] +@defproc[(sidebar [content pre-flow?] ...) block?] +@defproc[(marginfigure [content pre-flow?] ...) block?] +@defproc[(margintable [content pre-flow?] ...) block?] )]{ In the @racket[sigchi-a] format, special sidebars, tables and figures on the margin.} @deftogether[( -@defproc[(printonly [content pre-content?] ...) block?] -@defproc[(screenonly [content pre-content?] ...) block?] -@defproc[(anonsuppress [content pre-content?] ...) block?] +@defproc[(printonly [content pre-flow?] ...) block?] +@defproc[(screenonly [content pre-flow?] ...) block?] +@defproc[(anonsuppress [content pre-flow?] ...) block?] )]{ Marks content to be included only for print or screen editions, or excluded from anonymous editions.} -@defproc[(acks [content pre-content?] ...) block?]{ +@defproc[(acks [content pre-flow?] ...) block?]{ Creates an unnumbered section ``Acknowledgments'' section, unless the @racket[anonymous] mode is selected.} diff --git a/scribble-doc/scribblings/scribble/base.scrbl b/scribble-doc/scribblings/scribble/base.scrbl index 1231ca53..be57eaa4 100644 --- a/scribble-doc/scribblings/scribble/base.scrbl +++ b/scribble-doc/scribblings/scribble/base.scrbl @@ -130,7 +130,14 @@ Generates a @racket[paragraph] with style name @racket['author] to show the author(s) of a document, where each author is represented by @tech{content}. Normally, this function is used after @racket[title] for the beginning of a document. See also -@racket[author+email].} +@racket[author+email]. + +Examples: + +@codeblock[#:keep-lang-line? #f]|{ + #lang scribble/base + @author{Alice P. Racketeer} +}|} @defproc[(author+email [author-name content?] [email string?] @@ -143,7 +150,14 @@ address-harvesting robots. Note that @racket[author+email] is not a replacement for @racket[author]. The @racket[author+email] function is often used in -combination with @racket[author].} +combination with @racket[author]. + +Examples: + +@codeblock[#:keep-lang-line? #f]|{ + #lang scribble/base + @author[(author+email "Bob T. Scribbler" "bob@racket-lang.org")] +}|} @; ------------------------------------------------------------------------ @@ -599,7 +613,8 @@ Generates a literal hyperlinked URL.} @defproc[(secref [tag string?] [#:doc module-path (or/c module-path? #f) #f] [#:tag-prefixes prefixes (or/c (listof string?) #f) #f] - [#:underline? underline? any/c #t]) + [#:underline? underline? any/c #t] + [#:link-render-style ref-style (or/c link-render-style? #f)]) element?]{ Inserts a reference to the section tagged @racket[tag]. @@ -620,32 +635,35 @@ reach the @racket[tag] section. When @racket[#:doc] is not provided, the @racket[prefixes] path is relative to any enclosing section (i.e., the youngest ancestor that produces a match). -For HTML output, the generated reference is the hyperlinked title of -the elements in the section's title content, except that elements with -the @racket['aux] @tech{style property} are omitted in the hyperlink -label. If @racket[underline?] is @racket[#f], then the hyperlink is -rendered in HTML without an underline. - -For Latex output, the generated reference's format depends on the -document style. By default, only the section number is shown in the -reference, but the @racketmodname[scribble/manual] style shows the -title after the section number. Customize the output (see -@secref["config"]) by redefining the @ltx{BookRef}, @|etc|, macros (see -@secref["builtin-latex"]). +For the result @racket[link-element], if @racket[ref-style] is not +@racket[#f], then it is attached as a @tech{style property} and +affects the rendering of the link. Alternatively, an enclosing +@racket[part] can have a link-render style that adjusts the rendering +style for all links within the @tech{part}. See @racket[link-element] +for more information about the rendering of section references. +If @racket[underline?] is @racket[#f], then a @tech{style} is attached +to the result @racket[link-element] so that the hyperlink is rendered +in HTML without an underline + In Racket documentation that is rendered to HTML, clicking on a section title normally shows the @racket[secref] call that is needed -to link to the section.} +to link to the section. + +@history[#:changed "1.25" @elem{Added the @racket[#:link-render-style] argument.}]} @defproc[(Secref [tag string?] [#:doc module-path (or/c module-path? #f) #f] [#:tag-prefixes prefixes (or/c (listof string?) #f) #f] - [#:underline? underline? any/c #t]) + [#:underline? underline? any/c #t] + [#:link-render-style ref-style (or/c link-render-style? #f)]) element?]{ Like @racket[secref], but if the rendered form of the reference starts -with a word (e.g., ``section''), then the word is capitalized.} +with a word (e.g., ``section''), then the word is capitalized. + +@history[#:changed "1.25" @elem{Added the @racket[#:link-render-style] argument.}]} @defproc[(seclink [tag string?] diff --git a/scribble-doc/scribblings/scribble/core.scrbl b/scribble-doc/scribblings/scribble/core.scrbl index edc392b2..fba894ae 100644 --- a/scribble-doc/scribblings/scribble/core.scrbl +++ b/scribble-doc/scribblings/scribble/core.scrbl @@ -9,6 +9,7 @@ scriblib/render-cond xml/xexpr net/url-structs + scriblib/figure (only-in scribble/html-render render-mixin))) @title[#:tag "core"]{Structures And Processing} @@ -119,7 +120,8 @@ A @deftech{block} is either a @techlink{table}, an @itemize[ @item{A @deftech{content} can be a string, one of a few - symbols, an instance of @racket[element] (possibly + symbols, a convertible value in the sense of @racket[convertible?], + an instance of @racket[element] (possibly @racket[link-element], etc.), a @racket[multiarg-element], a @techlink{traverse element}, a @techlink{part-relative element}, a @techlink{delayed element}, or a list of content. @@ -144,6 +146,13 @@ A @deftech{block} is either a @techlink{table}, an rendered as the corresponding HTML entity (even for Latex output).} + @item{A convertible value in the sense of @racket[convertible?] + is used in a renderer-specific way, but values convertible + to @racket['text] renders the same as the resulting + string. If a renderer is not able to convert the value + to a known format, the value is converted to a string + using @racket[write].} + @item{An instance of @racket[element] has a @techlink{content} plus a @tech{style}. The style's interpretation depends on the renderer, but it @@ -230,6 +239,10 @@ A @deftech{block} is either a @techlink{table}, an ] +@history[#:changed "1.23" @elem{Changed the handling of @racket[convertible?] + values to recognize a @racket['text] conversion + and otherwise use @racket[write].}] + @; ------------------------------------------------------------------------ @section[#:tag "tags"]{Tags} @@ -370,7 +383,7 @@ names are as follows: @itemize[ - @item{@racket['index] --- The part represents an index.} + @item{@indexed-racket['index] --- The part represents an index.} ] @@ -378,24 +391,24 @@ The recognized @tech{style properties} are as follows: @itemize[ - @item{@racket['unnumbered] --- A section number is not computed or + @item{@indexed-racket['unnumbered] --- A section number is not computed or rendered for the section.} - @item{@racket['hidden-number] --- A section number is computed for + @item{@indexed-racket['hidden-number] --- A section number is computed for the section, but it is not rendered as part of the section name.} - @item{@racket['toc-hidden] --- The part title is not shown in tables + @item{@indexed-racket['toc-hidden] --- The part title is not shown in tables of contents, including in ``on this page'' boxes. For Latex rendering, the part title is omitted only if it is unnumbered or has a hidden number.} - @item{@racket['hidden] --- The part title is not shown; for Latex + @item{@indexed-racket['hidden] --- The part title is not shown; for Latex output, the part title is not shown only if its is empty, and in that case, it is also excluded from tables of contents. The @racket['toc-hidden] @tech{style property} usually should be included with @racket['hidden] (for consistency in non-Latex output).} - @item{@racket['grouper] --- The part is numbered with a Roman + @item{@indexed-racket['grouper] --- The part is numbered with a Roman numeral, by default, and its subsections continue numbering as if they appeared in the preceeding part. In other words, the part acts like a ``part'' in a book where chapter numbering is @@ -410,24 +423,24 @@ The recognized @tech{style properties} are as follows: @racket['unnumbered] property is also present, a @tech{numberer} property is ignored.} - @item{@racket['toc] --- Sub-parts of the part are rendered on separate + @item{@indexed-racket['toc] --- Sub-parts of the part are rendered on separate pages for multi-page HTML mode.} - @item{@racket['non-toc] --- Initial sub-parts of the part are + @item{@indexed-racket['non-toc] --- Initial sub-parts of the part are @emph{not} rendered on separate pages for multi-page HTML mode; this @tech{style property} applies only to the main part.} - @item{@racket['reveal] --- Shows sub-parts when this part is + @item{@indexed-racket['reveal] --- Shows sub-parts when this part is displayed in a table-of-contents panel in HTML output (which normally shows only the top-level sections).} - @item{@racket['quiet] --- In HTML output and most other output modes, + @item{@indexed-racket['quiet] --- In HTML output and most other output modes, hides entries for sub-parts of this part in a @racket[table-of-contents] or @racket[local-table-of-contents] listing except when those sub-parts are top-level entries in the listing.} - @item{@racket['no-toc] --- As a @tech{style property} for the main part of a + @item{@indexed-racket['no-toc] --- As a @tech{style property} for the main part of a rendered page, causes the HTML output to not include a margin box for the main table of contents; the ``on this page'' box that contains @racket[toc-element] and @racket[toc-target-element] @@ -435,10 +448,18 @@ The recognized @tech{style properties} are as follows: multi-page documents) takes on the location and color of the main table of contents, instead.} - @item{@racket['no-sidebar] --- As a @tech{style property} for the main part of a + @item{@indexed-racket['no-sidebar] --- As a @tech{style property} for the main part of a document, causes the HTML output to not include an ``on this page'' margin box.} + @item{@indexed-racket['no-index] --- Has no effect as a @tech{style + property} on a @racket[part], but as a style property on a + @racket[title] or @racket[part-start] that provides a + @racket[part]'s style via @racket[decode], the + @racket['no-index] @tech{style property} cause @racket[decode] + to skip the generation of an entry for the part's title in the + document index.} + @item{@racket[document-version] structure --- A version number for this part and its sub-parts (except as overridden). When it is not @racket[""] may be used when rendering a document; at a @@ -494,6 +515,11 @@ The recognized @tech{style properties} are as follows: module path plus a section-tag string, so that the user can create a reference to the section.} + @item{@racket[link-render-style] structure --- Determines the default + rendering of links to sections or other destinations within the + section. See also @racket[link-element] and + @racket[current-link-render-style].} + ] The @racket[to-collect] field contains @techlink{content} that is @@ -505,7 +531,8 @@ sub-parts). The @racket[parts] field contains sub-parts. -} +@history[#:changed "1.25" @elem{Added @racket['no-index] support.} + #:changed "1.26" @elem{Added @racket[link-render-style] support.}]} @defstruct[paragraph ([style style?] [content content?])]{ @@ -519,16 +546,16 @@ recognized: @itemize[ - @item{@racket['author] --- Typeset as the author of a document. Such + @item{@indexed-racket['author] --- Typeset as the author of a document. Such paragraphs normally should appear only in the initial flow of a @racket[part] for a document, where they are treated specially by the Latex renderer by moving the author information to the title.} - @item{@racket['pretitle] --- Typeset before the title of the + @item{@indexed-racket['pretitle] --- Typeset before the title of the enclosing part.} - @item{@racket['wraps] --- Like a @racket[#f] @tech{style name}, but not + @item{@indexed-racket['wraps] --- Like a @racket[#f] @tech{style name}, but not @tech{boxable} in the sense of @racket[box-mode] for Latex output.} ] @@ -540,12 +567,12 @@ The currently recognized @tech{style properties} are as follows: @itemize[ - @item{@racket['omitable] --- When a table cell contains a single + @item{@indexed-racket['omitable] --- When a table cell contains a single @racket[paragraph] with the @racket['omitable] @tech{style property}, then when rendering to HTML, no @tt{

} tag wraps the cell content.} - @item{@racket['div] --- Generates @tt{

} HTML output instead of + @item{@indexed-racket['div] --- Generates @tt{
} HTML output instead of @tt{

} (unless a @racket[alt-tag] property is provided).} @item{@racket[alt-tag] structure --- Generates the indicated HTML tag @@ -558,7 +585,7 @@ The currently recognized @tech{style properties} are as follows: as an @tt{id} attribute of the @tt{

}, @tt{

}, or alternate tag.} - @item{@racket['never-indents] --- For Latex and @tech{compound + @item{@indexed-racket['never-indents] --- For Latex and @tech{compound paragraphs}; see @racket[compound-paragraph].} @item{@racket[box-mode] structure --- For Latex output, uses an alternate @@ -585,14 +612,14 @@ recognized: @itemize[ - @item{@racket['boxed] --- Renders as a definition. + @item{@indexed-racket['boxed] --- Renders as a definition. This style name is not intended for use on a table that is nested within a @racket['boxed] table; nested uses may look right for some renders of the style but not others.} - @item{@racket['centered] --- Centers HTML output horizontally.} + @item{@indexed-racket['centered] --- Centers HTML output horizontally.} - @item{@racket['block] --- Prevents pages breaks in Latex output.} + @item{@indexed-racket['block] --- Prevents pages breaks in Latex output.} ] @@ -616,10 +643,10 @@ The following @tech{style properties} are currently recognized: @item{@racket[body-id] structure --- For HTML, uses the given string as an @tt{id} attribute of the @tt{} tag.} - @item{@racket['aux] --- For HTML, include the table in the + @item{@indexed-racket['aux] --- For HTML, include the table in the table-of-contents display for the enclosing part.} - @item{@racket['never-indents] --- For Latex and @tech{compound + @item{@indexed-racket['never-indents] --- For Latex and @tech{compound paragraphs}; see @racket[compound-paragraph].} ] @@ -648,9 +675,9 @@ names are recognized: @itemize[ - @item{@racket['compact] --- Reduces space between items.} + @item{@indexed-racket['compact] --- Reduces space between items.} - @item{@racket['ordered] --- Generates @tt{
    } HTML output instead + @item{@indexed-racket['ordered] --- Generates @tt{
      } HTML output instead of @tt{
        } or an Latex enumeration instead of an itemization.} ] @@ -665,7 +692,7 @@ The following @tech{style properties} are currently recognized: @item{@racket[body-id] structure --- For HTML, uses the given string as an @tt{id} attribute of the @tt{
          } or @tt{
            } tag.} - @item{@racket['never-indents] --- For Latex and @tech{compound + @item{@indexed-racket['never-indents] --- For Latex and @tech{compound paragraphs}; see @racket[compound-paragraph].} ]} @@ -683,15 +710,15 @@ names are recognized: @itemize[ - @item{@racket['inset] --- Insets the nested flow relative to + @item{@indexed-racket['inset] --- Insets the nested flow relative to surrounding text.} - @item{@racket['code-inset] --- Insets the nested flow relative to + @item{@indexed-racket['code-inset] --- Insets the nested flow relative to surrounding text in a way suitable for code. If the nested flow has a single block, then it is @tech{boxable} in the sense of @racket[box-mode] for Latex output.} - @item{@racket['vertical-inset] --- Insets the nested flow vertically + @item{@indexed-racket['vertical-inset] --- Insets the nested flow vertically relative to surrounding text, but not horizontally. If the nested flow has a single block, then it is @tech{boxable} in the sense of @racket[box-mode] for Latex output.} @@ -702,11 +729,11 @@ The following @tech{style properties} are currently recognized: @itemize[ - @item{@racket['command] --- For Latex output, a string @tech{style + @item{@indexed-racket['command] --- For Latex output, a string @tech{style name} is used as a command name instead of an environment name.} - @item{@racket['multicommand] --- For Latex output, a string + @item{@indexed-racket['multicommand] --- For Latex output, a string @tech{style name} is used as a command name with a separate argument for each block in @racket[blocks].} @@ -716,20 +743,20 @@ The following @tech{style properties} are currently recognized: @item{@racket[body-id] structure --- For HTML, uses the given string as an @tt{id} attribute of the @tt{
            } tag.} - @item{@racket['never-indents] --- For Latex and @tech{compound + @item{@indexed-racket['never-indents] --- For Latex and @tech{compound paragraphs}; see @racket[compound-paragraph].} @item{@racket[box-mode] structure --- For Latex output, uses an alternate rendering form for @tech{boxing contexts} (such as a table cell); see @racket[box-mode].} - @item{@racket['decorative] --- The content of the nested flow is intended + @item{@indexed-racket['decorative] --- The content of the nested flow is intended for decoration. Text output skips a decorative nested flow.} @item{@racket[alt-tag] structure --- Generates the indicated HTML tag instead of @tt{
            }.} - @item{@racket['pretitle] --- For Latex, raises the contents + @item{@indexed-racket['pretitle] --- For Latex, raises the contents of the flow to above the title.} ]} @@ -756,7 +783,7 @@ for Latex output (see @secref["extra-style"]). The following @itemize[ - @item{@racket['command] --- For Latex output, a string @tech{style + @item{@indexed-racket['command] --- For Latex output, a string @tech{style name} is used as a command name instead of an environment name.} @@ -769,7 +796,7 @@ for Latex output (see @secref["extra-style"]). The following @item{@racket[body-id] structure --- For HTML, uses the given string as an @tt{id} attribute of the @tt{

            } or alternate tag.} - @item{@racket['never-indents] --- For Latex within another + @item{@indexed-racket['never-indents] --- For Latex within another @tech{compound paragraph}; see above.} ]} @@ -831,18 +858,18 @@ recognized: @itemize[ - @item{@racket['tt], @racket['italic], @racket['bold], @racket['roman], @racket['sf], + @item{@indexed-racket['tt], @racket['italic], @racket['bold], @racket['roman], @racket['sf], @racket['url], @racket['subscript], @racket['superscript], @racket['smaller], @racket['larger] --- Basic styles recognized by all renders.} - @item{@racket['hspace] --- Renders its @racket[content] as monospace + @item{@indexed-racket['hspace] --- Renders its @racket[content] as monospace blanks.} - @item{@racket['newline] --- Renders a line break independent of + @item{@indexed-racket['newline] --- Renders a line break independent of the @racket[content].} - @item{@racket['no-break] --- Prevents line breaks when rendering + @item{@indexed-racket['no-break] --- Prevents line breaks when rendering @racket[content].} ] @@ -878,15 +905,15 @@ The following @tech{style properties} are currently recognized: @item{@racket[body-id] structure --- For HTML uses the given string as an @tt{id} attribute of the @tt{} tag.} - @item{@racket['aux] --- Intended for use in titles, where the + @item{@indexed-racket['aux] --- Intended for use in titles, where the auxiliary part of the title can be omitted in hyperlinks. See, for example, @racket[secref].} - @item{@racket['tt-chars] --- For Latex output, when the @tech{style + @item{@indexed-racket['tt-chars] --- For Latex output, when the @tech{style name} is a string, render the element's content with escapes suitable for Latex @tt{tt} mode.} - @item{@racket['exact-chars] --- For Latex output, when the @tech{style + @item{@indexed-racket['exact-chars] --- For Latex output, when the @tech{style name} is a string or @racket[#f], render the elements content exactly (without escapes).} @@ -962,19 +989,66 @@ field.} @defstruct[(link-element element) ([tag tag?])]{ -Hyperlinks the content to @racket[_tag]. +Represents a hyperlink to @racket[_tag]. +Normally, the content of the element is rendered as the hyperlink. When @racket[_tag] is a part tag and the content of the element is -@racket[null], then the hyperlink uses the target part's number and/or -title as the content. In that case, if the section number is preceded -by a word, the word starts in uppercase if the element's style includes a -@racket['uppercase] property. +@racket[null], however, rendering is treated specially based on the +@racket[_mode] value of a @racket[link-render-style] @tech{style +property}: -The following symbol is recognized as a @tech{style property}: +@itemlist[ + + @item{For HTML output, in the @racket['default] mode, the generated + reference is the hyperlinked title of the elements in the + section's title content, except that elements with the + @racket['aux] @tech{style property} are omitted in the + hyperlink label. + + In @racket['number] mode, the section title is not shown. + Instead, the word ``section'' is shown followed by a + hyperlinked section number. The word ``section'' starts in + uppercase if the element's style includes a @racket['uppercase] + property.} + + @item{For Latex/PDF output, the generated reference's format can + depend on the document style in addition the @racket[_mode]. + For the @racket['default] mode and a default document style, a + section number is shown by the word ``section'' followed by the + section number, and the word ``section'' and the section number + are together hyperlinked. The word ``section'' starts in + uppercase if the element's style includes a @racket['uppercase] + property. The @racketmodname[scribble/manual] style uses the + symbol ``§'' in place of the word ``section''. + + In @racket['number] mode, rendering is the same, except that + only the number is hyperlinked, not the word ``section'' or + the ``§'' symbol. + + A new document style can customize Latex/PDF output (see + @secref["config"]) by redefining the @ltx{SecRefLocal}, @|etc|, + macros (see @secref["builtin-latex"]). The @ltx{SecRef}, + @|etc|, variants are used in @racket['number] mode.} + +] + +If a @racket[link-render-style] @tech{style property} is not attached +to a @racket[link-element] that refers to a part, a +@racket[link-render-style] @tech{style property} that is attached to +an enclosing part is used, since attaching a +@racket[link-render-style] @tech{style property} to a part causes +@racket[current-link-render-style] to be set while rendering the part. +Otherwise, the render-time value of @racket[current-link-render-style] +determine's a @racket[link-element]'s rendering. + +The following style properties are recognized in addition to the style +properties for all @racket[element]s: @itemize[ - @item{@racket['indirect-link] --- For HTML output, treats the link as + @item{@racket[link-render-style] structure --- As described above.} + + @item{@indexed-racket['indirect-link] --- For HTML output, treats the link as ``external''. When rendering to HTML and the @method[render-mixin set-external-tag-path] method is called to provide an external-link URL, then the resolution of the @@ -982,7 +1056,9 @@ The following symbol is recognized as a @tech{style property}: some cases, patched by JavaScript when the documentation is viewed in a browser).} -]} +] + +@history[#:changed "1.26" @elem{Added @racket[link-render-style] support.}]} @defstruct[(index-element element) ([tag tag?] @@ -1119,7 +1195,7 @@ reverse order): ] -@history[#:changed "6.4" @elem{Added @racket[(list/c string? string?)] +@history[#:changed "1.1" @elem{Added @racket[(list/c string? string?)] number items for @tech{numberer}-generated section numbers.}]} @@ -1176,26 +1252,26 @@ The following are recognized as cell-@tech{style properties}: @itemize[ - @item{@racket['left] --- Left-align the cell content.} + @item{@indexed-racket['left] --- Left-align the cell content.} - @item{@racket['right] --- Right-align the cell content top baselines.} + @item{@indexed-racket['right] --- Right-align the cell content top baselines.} - @item{@racket['center] --- Center the cell content horizontally.} + @item{@indexed-racket['center] --- Center the cell content horizontally.} - @item{@racket['top] --- Top-align the cell content.} + @item{@indexed-racket['top] --- Top-align the cell content.} - @item{@racket['baseline] --- Align the cell content top baselines.} + @item{@indexed-racket['baseline] --- Align the cell content top baselines.} - @item{@racket['bottom] --- bottom-align the cell content.} + @item{@indexed-racket['bottom] --- bottom-align the cell content.} - @item{@racket['vcenter] --- Center the cell content vertically.} + @item{@indexed-racket['vcenter] --- Center the cell content vertically.} - @item{@racket['border] --- Draw a line around all sides of the + @item{@indexed-racket['border] --- Draw a line around all sides of the cell. Borders along a shared edge of adjacent cells are collapsed into a single line.} - @item{@racket['left-border], @racket['right-border], - @racket['top-border], or @racket['bottom-border] --- Draw a + @item{@indexed-racket['left-border], @indexed-racket['right-border], + @indexed-racket['top-border], or @indexed-racket['bottom-border] --- Draw a line along the corresponding side of the cell (with the same border collapsing as for @racket['border]).} @@ -1354,7 +1430,7 @@ Return @racket[#t] if @racket[v] is @racket[#f], an exact non-negative integer, a string, or a list containing two strings. See @racket[collected-info] for information on how different representations are used for numbering. -@history[#:added "6.4"]} +@history[#:added "1.1"]} @deftogether[( @@ -1409,7 +1485,38 @@ number for each subsection. If @racket[numberer-step] produces a plain string for the rendered number, then it is not added as a prefix to subsection numbers. See also @racket[collected-info]. -@history[#:added "6.4"]} +@history[#:added "1.1"]} + + +@defstruct[link-render-style ([mode (or/c 'default 'number)])]{ + +Used as a @tech{style property} for a @racket[part] or a specific +@racket[link-element] to control the way that a hyperlink is rendered +for a part via @racket[secref] or for a figure via @racket[figure-ref] +from @racketmodname[scriblib/figure]. + +The @racket['default] and @racket['number] modes represent generic +hyperlink-style configurations that could make sense for various kinds +of references. The @racket['number] style is intended to mean that a +specific number is shown for the reference and that only the number is +hyperlinked. The @racket['default] style is more flexible, allowing a +more appropriate choice for the rendering context, such as using the +target section's name for a hyperlink in HTML. + +@history[#:added "1.26"]} + + +@defparam[current-link-render-style style link-render-style?]{ + +A parameter that determines the default rendering style for a section +link. + +When a @racket[part] has a @racket[link-render-style] as one of its +@tech{style properties}, then the @racket[current-link-render-style] +parameter is set during the @tech{resolve pass} and @tech{render pass} +for the @racket[part]'s content. + +@history[#:added "1.26"]} @defstruct[collect-info ([fp any/c] [ht any/c] [ext-ht any/c] diff --git a/scribble-doc/scribblings/scribble/decode.scrbl b/scribble-doc/scribblings/scribble/decode.scrbl index 3ce70c5a..3758ac13 100644 --- a/scribble-doc/scribblings/scribble/decode.scrbl +++ b/scribble-doc/scribblings/scribble/decode.scrbl @@ -94,8 +94,15 @@ parsing. Instances of @racket[section] trigger are used as-is as subsections, and instances of @racket[paragraph] and other flow-element datatypes are used as-is in the enclosing flow. +As a part is decoded, as long as the style for the part does not +include the @tech{style property} @racket['hidden] or +@racket['no-index], an entry is added to the document index for the +part's title. + Portions of @racket[lst] are within a part are decoded using -@racket[decode-flow].} +@racket[decode-flow]. + +@history[#:changed "1.25" @elem{Added @racket['no-index] support.}]} @defproc[(decode-part [lst (listof pre-part?)] diff --git a/scribble-doc/scribblings/scribble/examples.scrbl b/scribble-doc/scribblings/scribble/examples.scrbl index 5e8fa620..df69f4fa 100644 --- a/scribble-doc/scribblings/scribble/examples.scrbl +++ b/scribble-doc/scribblings/scribble/examples.scrbl @@ -177,10 +177,11 @@ As an example, @codeblock|{ #lang scribble/manual @(require racket/sandbox - scribble/eval) + scribble/example) @(define my-evaluator (parameterize ([sandbox-output 'string] - [sandbox-error-output 'string]) + [sandbox-error-output 'string] + [sandbox-memory-limit 50]) (make-evaluator 'typed/racket/base))) @examples[#:eval my-evaluator diff --git a/scribble-doc/scriblib/scribblings/autobib.scrbl b/scribble-doc/scriblib/scribblings/autobib.scrbl index 50baa4cd..d9f6f5c4 100644 --- a/scribble-doc/scriblib/scribblings/autobib.scrbl +++ b/scribble-doc/scriblib/scribblings/autobib.scrbl @@ -58,7 +58,7 @@ includes a citation to section 8 of the Racket reference. (code:line #:date=? date-compare-expr) (code:line #:cite-author cite-author-id) (code:line #:cite-year cite-year-id)]) - #:contracts ([style-expr (or/c author+date-style number-style)] + #:contracts ([style-expr (or/c number-style author+date-style author+date-square-bracket-style)] [spaces-expr number?] [disambiguator-expr (or/c #f (-> exact-nonnegative-integer? element?))] [render-date-expr (or/c #f (-> date? element?))] @@ -144,10 +144,16 @@ optionally given @racket[render-date-expr] functions. @deftogether[( @defthing[author+date-style any/c] +@defthing[author+date-square-bracket-style any/c] @defthing[number-style any/c] )]{ -Styles for use with @racket[define-cite].} +Styles for use with @racket[define-cite]. + +The @racket[author+date-square-bracket-style] definition is the same +as @racket[author+date-style], except that references to citations +are enclosed in @litchar["[]"] instead of @litchar["()"]. +} @defproc[(bib? [v any/c]) boolean?]{ diff --git a/scribble-doc/scriblib/scribblings/figure.scrbl b/scribble-doc/scriblib/scribblings/figure.scrbl index dc7a84be..2a087251 100644 --- a/scribble-doc/scriblib/scribblings/figure.scrbl +++ b/scribble-doc/scriblib/scribblings/figure.scrbl @@ -15,21 +15,29 @@ @defproc[(figure [tag string?] [caption content?] [p pre-flow?] ... [#:style style style? center-figure-style] + [#:label-sep label-sep pre-content? ": "] + [#:label-style label-style element-style? #f] [#:continue? continue? any/c #f]) block?] @defproc[(figure* [tag string?] [caption content?] [p pre-flow?] ... [#:style style style? center-figure-style] - [#:continue? continue? any/c #f]) + [#:label-sep label-sep pre-content? ": "] + [#:label-style label-style element-style? #f] + [#:continue? continue? any/c #f]) block?] @defproc[(figure** [tag string?] [caption content?] [p pre-flow?] ... [#:style style style? center-figure-style] + [#:label-sep label-sep pre-content? ": "] + [#:label-style label-style element-style? #f] [#:continue? continue? any/c #f]) block?] @defproc[(figure-here [tag string?] [caption content?] [pre-flow pre-flow?] ... [#:style style style? center-figure-style] + [#:label-sep label-sep pre-content? ": "] + [#:label-style label-style element-style? #f] [#:continue? continue? any/c #f]) block?] )]{ @@ -52,8 +60,18 @@ By default, @racket[style] is set so that the content of the figure is centered. Use @racket[left-figure-style], @racket[center-figure-style], or @racket[right-figure-style] to specify the alignment. +The @racket[label-sep] and @racket[label-style] arguments adjust the +way that the caption's label is shown. By default, the label is the +word ``Figure'' followed by a space, the figure number, ``:'', and a +space, but @racket[label-sep] can specify an alternative to the ``:'' +and ending space. The composed label is given the style specified by +@racket[label-style]. + If @racket[continue?] is a true value, then the figure counter is not -incremented.} +incremented. + +@history[#:changed "1.24" @elem{Added the @racket[#:label-sep] and + @racket[#:label-style] arguments.}]} @deftogether[( @defthing[left-figure-style style?] @@ -67,14 +85,28 @@ The @racket[left] binding is a synonym for @racket[left-figure-style], provided for backward compatibility.} -@defproc[(figure-ref [tag string?] ...+) element?]{ +@defproc[(figure-ref [tag string?] ...+ + [#:link-render-style link-style (or/c link-render-style? #f)]) + element?]{ -Generates a reference to one or more figures, using a lowercase word ``figure''.} +Generates a reference to one or more figures, using a lowercase word ``figure''. + +If @racket[link-style] or @racket[(current-link-render-style)] at the +time of rendering indicates the @racket['number] style mode, then the +word ``figure'' itself is not hyperlinked. Otherwise, the word +@racket[figure] is hyperlinked together with the referenced figure's +number. + +@history[#:changed "1.26" @elem{Added the @racket[#:link-render-style] argument.}]} -@defproc[(Figure-ref [tag string?] ...+) element?]{ +@defproc[(Figure-ref [tag string?] ...+ + [#:link-render-style link-style (or/c link-render-style? #f)]) + element?]{ -Generates a reference to one or more figures, capitalizing the word ``Figure''.} +Like @racket[figure-ref], but capitalizes the word ``Figure''. + +@history[#:changed "1.26" @elem{Added the @racket[#:link-render-style] argument.}]} @defproc[(Figure-target [tag string?] diff --git a/scribble-lib/info.rkt b/scribble-lib/info.rkt index 308acee3..9e816460 100644 --- a/scribble-lib/info.rkt +++ b/scribble-lib/info.rkt @@ -23,4 +23,4 @@ (define pkg-authors '(mflatt eli)) -(define version "1.22") +(define version "1.26") diff --git a/scribble-lib/scribble/acmart.rkt b/scribble-lib/scribble/acmart.rkt index f66f812b..b993bba7 100644 --- a/scribble-lib/scribble/acmart.rkt +++ b/scribble-lib/scribble/acmart.rkt @@ -70,13 +70,14 @@ [acmConference (-> string? string? string? block?)] [grantsponsor - (-> string? string? string? block?)] + (-> string? string? string? content?)] [grantnum - (->* (string? string?) (#:url string?) block?)] + (->* (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)]) @@ -105,7 +106,7 @@ (define-syntax-rule (define-environments name ...) (begin (begin - (provide/contract [name (->* () () #:rest (listof pre-content?) + (provide/contract [name (->* () () #:rest (listof pre-flow?) block?)]) (define (name . str) (make-nested-flow (make-style (symbol->string 'name) acmart-extras) @@ -116,7 +117,7 @@ (define-syntax-rule (define-comment-environments name ...) (begin (begin - (provide/contract [name (->* () () #:rest (listof pre-content?) + (provide/contract [name (->* () () #:rest (listof pre-flow?) block?)]) (define (name . str) (make-nested-flow (make-style (symbol->string 'name) acmart-extras) @@ -162,39 +163,37 @@ (decode-string venue))))) (define (grantsponsor id name url) - (make-paragraph (make-style 'pretitle '()) - (make-multiarg-element (make-style "grantsponsor" multicommand-props) - (list (decode-string id) - (decode-string name) - (decode-string url))))) + (make-multiarg-element (make-style "grantsponsor" multicommand-props) + (list (decode-string id) + (decode-string name) + (decode-string url)))) (define (grantnum #:url [url #f] id num) - (make-paragraph (make-style 'pretitle '()) - (if url - (make-multiarg-element (make-style "SgrantnumURL" multicommand-props) - (list (decode-string url) - (decode-string id) - (decode-string num))) - (make-multiarg-element (make-style "grantnum" multicommand-props) - (list (decode-string id) - (decode-string num)))))) + (if url + (make-multiarg-element (make-style "SgrantnumURL" multicommand-props) + (list (decode-string url) + (decode-string id) + (decode-string num))) + (make-multiarg-element (make-style "grantnum" multicommand-props) + (list (decode-string id) + (decode-string num))))) (define (acmBadgeR #:url [url #f] str) (make-paragraph (make-style 'pretitle '()) (if url - (make-multiarg-element (make-style "SacmBadgeRURL" multicommand-props) + (make-multiarg-element (make-style "SacmBadgeRURL" (cons 'exact-chars multicommand-props)) (list (decode-string url) (decode-string str))) - (make-element (make-style "acmBadgeR" command-props) + (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 - (make-multiarg-element (make-style "SacmBadgeLURL" multicommand-props) + (make-multiarg-element (make-style "SacmBadgeLURL" (cons 'exact-chars multicommand-props)) (list (decode-string url) (decode-string str))) - (make-element (make-style "acmBadgeL" command-props) + (make-element (make-style "acmBadgeL" (cons 'exact-chars command-props)) (decode-string str))))) (define (received #:stage [s #f] str) @@ -214,10 +213,10 @@ (define (ccsdesc #:number [n #f] str) (make-paragraph (make-style 'pretitle '()) (if n - (make-multiarg-element (make-style "SccsdescNumber" multicommand-props) + (make-multiarg-element (make-style "SccsdescNumber" (cons 'exact-chars multicommand-props)) (list (number->string n) (decode-string str))) - (make-element (make-style "ccsdesc" command-props) + (make-element (make-style "ccsdesc" (cons 'exact-chars command-props)) (decode-string str))))) (define (title #:tag [tag #f] diff --git a/scribble-lib/scribble/acmart/acmart-load.tex b/scribble-lib/scribble/acmart/acmart-load.tex index f08c99fb..80764311 100644 --- a/scribble-lib/scribble/acmart/acmart-load.tex +++ b/scribble-lib/scribble/acmart/acmart-load.tex @@ -1,4 +1,10 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% BEGIN acmart-load.tex % Avoid package option conflict \renewcommand\packageColor\relax +\renewcommand\packageTocstyle\relax \let\Footnote\undefined \let\captionwidth\undefined +\renewcommand{\renewrmdefault}{} +% END acmart-load.tex +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/scribble-lib/scribble/acmart/acmart.cls b/scribble-lib/scribble/acmart/acmart.cls index f6c56ed7..987e3c41 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/05/14 v1.39 Typesetting articles for Association of +[2017/09/16 v1.48 Typesetting articles for the Association for Computing Machinery] \def\@classname{acmart} \InputIfFileExists{acmart-preload-hook.tex}{% @@ -68,15 +68,24 @@ Computing Machinery] \PackageInfo{\@classname}{Using screen mode}% \else \PackageInfo{\@classname}{Not using screen mode}% - \fi}{\PackageError{\@classname}{Option screen can be either true or + \fi}{\PackageError{\@classname}{The option screen can be either true or false}} \ExecuteOptionsX{screen=false} +\define@boolkey+{acmart.cls}[@ACM@]{acmthm}[true]{% + \if@ACM@acmthm + \PackageInfo{\@classname}{Requiring acmthm}% + \else + \PackageInfo{\@classname}{Suppressing acmthm}% + \fi}{\PackageError{\@classname}{The option acmthm can be either true or + false}} +\ExecuteOptionsX{acmthm=true} \define@boolkey+{acmart.cls}[@ACM@]{review}[true]{% \if@ACM@review \PackageInfo{\@classname}{Using review mode}% + \AtBeginDocument{\@ACM@printfoliostrue}% \else \PackageInfo{\@classname}{Not using review mode}% - \fi}{\PackageError{\@classname}{Option review can be either true or + \fi}{\PackageError{\@classname}{The option review can be either true or false}} \ExecuteOptionsX{review=false} \define@boolkey+{acmart.cls}[@ACM@]{authorversion}[true]{% @@ -84,7 +93,7 @@ Computing Machinery] \PackageInfo{\@classname}{Using authorversion mode}% \else \PackageInfo{\@classname}{Not using authorversion mode}% - \fi}{\PackageError{\@classname}{Option authorversion can be either true or + \fi}{\PackageError{\@classname}{The option authorversion can be either true or false}} \ExecuteOptionsX{authorversion=false} \define@boolkey+{acmart.cls}[@ACM@]{natbib}[true]{% @@ -92,7 +101,7 @@ Computing Machinery] \PackageInfo{\@classname}{Explicitly selecting natbib mode}% \else \PackageInfo{\@classname}{Explicitly deselecting natbib mode}% - \fi}{\PackageError{\@classname}{Option natbib can be either true or + \fi}{\PackageError{\@classname}{The option natbib can be either true or false}} \ExecuteOptionsX{natbib=true} \define@boolkey+{acmart.cls}[@ACM@]{anonymous}[true]{% @@ -100,7 +109,7 @@ Computing Machinery] \PackageInfo{\@classname}{Using anonymous mode}% \else \PackageInfo{\@classname}{Not using anonymous mode}% - \fi}{\PackageError{\@classname}{Option anonymous can be either true or + \fi}{\PackageError{\@classname}{The option anonymous can be either true or false}} \ExecuteOptionsX{anonymous=false} \define@boolkey+{acmart.cls}[@ACM@]{timestamp}[true]{% @@ -108,7 +117,7 @@ Computing Machinery] \PackageInfo{\@classname}{Using timestamp mode}% \else \PackageInfo{\@classname}{Not using timestamp mode}% - \fi}{\PackageError{\@classname}{Option timestamp can be either true or + \fi}{\PackageError{\@classname}{The option timestamp can be either true or false}} \ExecuteOptionsX{timestamp=false} \define@boolkey+{acmart.cls}[@ACM@]{authordraft}[true]{% @@ -118,7 +127,7 @@ Computing Machinery] \@ACM@reviewtrue \else \PackageInfo{\@classname}{Not using authordraft mode}% - \fi}{\PackageError{\@classname}{Option authordraft can be either true or + \fi}{\PackageError{\@classname}{The option authordraft can be either true or false}} \ExecuteOptionsX{authordraft=false} \def\ACM@fontsize{} @@ -134,7 +143,7 @@ Computing Machinery] \newif\if@ACM@journal \newif\if@ACM@sigchiamode \ifnum\ACM@format@nr=5\relax % siggraph - \ClassWarning{\@classname}{The format `siggraph' is now obsolete. + \ClassWarning{\@classname}{The format siggraph is now obsolete. I am switching to sigconf.} \setkeys{acmart.cls}{format=sigconf} \fi @@ -190,12 +199,31 @@ 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} \RequirePackage{environ} \if@ACM@manuscript \RequirePackage{setspace} \onehalfspacing \fi +\RequirePackage{textcase} \if@ACM@natbib \RequirePackage{natbib} \renewcommand{\bibsection}{% @@ -382,7 +410,7 @@ Computing Machinery] \def\@svsechd{#4{\hskip #1\relax #5}}% \fi \@xsect{#3}} -\def\@starttoc#1#2{\begingroup +\def\@starttoc#1#2{\begingroup\makeatletter \setTrue{#1}% \par\removelastskip\vskip\z@skip \@startsection{section}\@M\z@{\linespacing\@plus\linespacing}% @@ -395,6 +423,7 @@ Computing Machinery] \global\@nobreakfalse \endgroup \addvspace{32\p@\@plus14\p@}% } +\def\l@section{\@tocline{1}{0pt}{1pc}{2pc}{}} \def\l@subsection{\@tocline{2}{0pt}{1pc}{3pc}{}} \def\l@subsubsection{\@tocline{2}{0pt}{1pc}{5pc}{}} \let\@footnotemark@nolink\@footnotemark @@ -420,15 +449,16 @@ Computing Machinery] \or % sigchi-a \urlstyle{sf} \fi -\if@ACM@screen - \hypersetup{colorlinks, - linkcolor=ACMRed, - citecolor=ACMPurple, - urlcolor=ACMDarkBlue, - filecolor=ACMDarkBlue} -\else - \hypersetup{hidelinks} -\fi +\AtEndPreamble{% + \if@ACM@screen + \hypersetup{colorlinks, + linkcolor=ACMRed, + citecolor=ACMPurple, + urlcolor=ACMDarkBlue, + filecolor=ACMDarkBlue} + \else + \hypersetup{hidelinks} + \fi} \if@ACM@natbib \let\citeN\cite \let\cite\citep @@ -476,55 +506,55 @@ Computing Machinery] \ifcase\ACM@format@nr \relax % manuscript \geometry{letterpaper,head=13pt, - marginparwidth=6pc}% + marginparwidth=6pc,heightrounded}% \or % acmsmall \geometry{twoside=true, includeheadfoot, head=13pt, foot=2pc, paperwidth=6.75in, paperheight=10in, top=58pt, bottom=44pt, inner=46pt, outer=46pt, - marginparwidth=2pc + marginparwidth=2pc,heightrounded }% \or % acmlarge \geometry{twoside=true, head=13pt, foot=2pc, paperwidth=8.5in, paperheight=11in, includeheadfoot, top=78pt, bottom=114pt, inner=81pt, outer=81pt, - marginparwidth=4pc + marginparwidth=4pc,heightrounded }% \or % acmtog \geometry{twoside=true, head=13pt, foot=2pc, paperwidth=8.5in, paperheight=11in, includeheadfoot, columnsep=24pt, top=52pt, bottom=75pt, inner=52pt, outer=52pt, - marginparwidth=2pc + marginparwidth=2pc,heightrounded }% \or % sigconf \geometry{twoside=true, head=13pt, paperwidth=8.5in, paperheight=11in, includeheadfoot, columnsep=2pc, top=57pt, bottom=73pt, inner=54pt, outer=54pt, - marginparwidth=2pc + marginparwidth=2pc,heightrounded }% \or % siggraph \geometry{twoside=true, head=13pt, paperwidth=8.5in, paperheight=11in, includeheadfoot, columnsep=2pc, top=57pt, bottom=73pt, inner=54pt, outer=54pt, - marginparwidth=2pc + marginparwidth=2pc,heightrounded }% \or % sigplan \geometry{twoside=true, head=13pt, paperwidth=8.5in, paperheight=11in, includeheadfoot=false, columnsep=2pc, top=1in, bottom=1in, inner=0.75in, outer=0.75in, - marginparwidth=2pc + marginparwidth=2pc,heightrounded }% \or % sigchi \geometry{twoside=true, head=13pt, paperwidth=8.5in, paperheight=11in, includeheadfoot, columnsep=2pc, top=66pt, bottom=73pt, inner=54pt, outer=54pt, - marginparwidth=2pc + marginparwidth=2pc,heightrounded }% \or % sigchi-a \geometry{twoside=false, head=13pt, @@ -555,6 +585,8 @@ Computing Machinery] \hrule \@width \columnwidth \kern 2.6\p@} \RequirePackage{manyfoot} \SelectFootnoteRule[2]{copyrightpermission} +\DeclareNewFootnote{authorsaddresses} +\SelectFootnoteRule[2]{copyrightpermission} \DeclareNewFootnote{copyrightpermission} \def\footnoterule{\kern-3\p@ \hrule \@width 4pc \kern 2.6\p@} @@ -566,7 +598,7 @@ Computing Machinery] \normalcolor \unvbox\@mpfootins \fi - \@minipagefalse %% added 24 May 89 + \@minipagefalse \color@endgroup \egroup \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}} @@ -601,18 +633,26 @@ Computing Machinery] \RequirePackage{iftex} \ifPDFTeX \input{glyphtounicode} +\pdfglyphtounicode{f_f}{FB00} +\pdfglyphtounicode{f_f_i}{FB03} +\pdfglyphtounicode{f_f_l}{FB04} +\pdfglyphtounicode{f_i}{FB01} +\pdfglyphtounicode{t_t}{00740074} +\pdfglyphtounicode{f_t}{00660074} +\pdfglyphtounicode{T_h}{00540068} \pdfgentounicode=1 \fi \RequirePackage{cmap} \newif\if@ACM@newfonts \@ACM@newfontstrue \IfFileExists{libertine.sty}{}{\ClassWarning{\@classname}{You do not - have libertine package installed. Please upgrade your + have the libertine package installed. Please upgrade your TeX}\@ACM@newfontsfalse} \IfFileExists{zi4.sty}{}{\ClassWarning{\@classname}{You do not - have zi4 package installed. Please upgrade your TeX}\@ACM@newfontsfalse} + have the zi4 package installed. Please upgrade your + TeX}\@ACM@newfontsfalse} \IfFileExists{newtxmath.sty}{}{\ClassWarning{\@classname}{You do not - have newtxmath package installed. Please upgrade your + have the newtxmath package installed. Please upgrade your TeX}\@ACM@newfontsfalse} \if@ACM@newfonts \RequirePackage[tt=false, type1=true]{libertine} @@ -620,6 +660,9 @@ Computing Machinery] \RequirePackage[libertine]{newtxmath} \RequirePackage[T1]{fontenc} \fi +\let\liningnums\@undefined +\AtEndPreamble{% + \DeclareTextFontCommand{\liningnums}{\libertineLF}} \if@ACM@sigchiamode \renewcommand{\familydefault}{\sfdefault} \fi @@ -627,7 +670,7 @@ Computing Machinery] \captionsetup[table]{position=top} \if@ACM@journal \captionsetup{labelfont={sf, small}, - textfont={sf, small}, margin=\z@} + textfont={sf, small}, margin=\z@} \captionsetup[figure]{name={Fig.}} \else \captionsetup{labelfont={bf}, @@ -769,6 +812,7 @@ Computing Machinery] TCPS,% TEAC,% TECS,% + THRI,% TIIS,% TISSEC,% TIST,% @@ -814,6 +858,8 @@ Computing Machinery] Wearable and Ubiquitous Technologies}% \def\@journalNameShort{Proc. ACM Interact. Mob. Wearable Ubiquitous Technol.}% \def\@permissionCodeOne{2474-9567}% + \@ACM@screentrue + \PackageInfo{\@classname}{Using screen mode due to \@journalCode}% \or % JACM \def\@journalName{Journal of the ACM}% \def\@journalNameShort{J. ACM}% @@ -836,19 +882,25 @@ Computing Machinery] \def\@permissionCodeOne{1550-4832}% \or % JOCCH \def\@journalName{ACM Journal on Computing and Cultural Heritage}% - \def\@journalName{ACM J. Comput. Cult. Herit.}% + \def\@journalNameShort{ACM J. Comput. Cult. Herit.}% \or % PACMHCI \def\@journalName{Proceedings of the ACM on Human-Computer Interaction}% - \def\@journalName{Proc. ACM Hum.-Comput. Interact.}% + \def\@journalNameShort{Proc. ACM Hum.-Comput. Interact.}% \def\@permissionCodeOne{2573-0142}% + \@ACM@screentrue + \PackageInfo{\@classname}{Using screen mode due to \@journalCode}% \or % PACMPL \def\@journalName{Proceedings of the ACM on Programming Languages}% - \def\@journalName{Proc. ACM Program. Lang.}% + \def\@journalNameShort{Proc. ACM Program. Lang.}% \def\@permissionCodeOne{2475-1421}% + \@ACM@screentrue + \PackageInfo{\@classname}{Using screen mode due to \@journalCode}% \or % POMACS \def\@journalName{Proceedings of the ACM on Measurement and Analysis of Computing Systems}% - \def\@journalName{Proc. ACM Meas. Anal. Comput. Syst.}% + \def\@journalNameShort{Proc. ACM Meas. Anal. Comput. Syst.}% \def\@permissionCodeOne{2476-1249}% + \@ACM@screentrue + \PackageInfo{\@classname}{Using screen mode due to \@journalCode}% \or % TAAS \def\@journalName{ACM Transactions on Autonomous and Adaptive Systems}% \def\@journalNameShort{ACM Trans. Autonom. Adapt. Syst.}% @@ -859,6 +911,7 @@ Computing Machinery] \def\@permissionCodeOne{1936-7228}% \or % TACO \def\@journalName{ACM Transactions on Architecture and Code Optimization}% + \def\@journalNameShort{ACM Trans. Arch. Code Optim.}% \or % TALG \def\@journalName{ACM Transactions on Algorithms}% \def\@journalNameShort{ACM Trans. Algor.}% @@ -877,6 +930,10 @@ Computing Machinery] \def\@journalName{ACM Transactions on Embedded Computing Systems}% \def\@journalNameShort{ACM Trans. Embedd. Comput. Syst.}% \def\@permissionCodeOne{1539-9087}% +\or % THRI + \def\@journalName{ACM Transactions on Human-Robot Interaction}% + \def\@journalNameShort{ACM Trans. Hum.-Robot Interact.}% + \def\@permissionCodeOne{2573-9522}% \or % TIIS \def\@journalName{ACM Transactions on Interactive Intelligent Systems}% \def\@journalNameShort{ACM Trans. Interact. Intell. Syst.}% @@ -930,7 +987,6 @@ Computing Machinery] \def\@journalNameShort{ACM Trans. Graph.}% \def\@permissionCodeOne{0730-0301} \or % TOIS - \def\@journalName{ACM Transactions on Information Systems}% \def\@journalName{ACM Transactions on Information Systems}% \def\@permissionCodeOne{1046-8188}% \or % TOIT @@ -938,7 +994,6 @@ Computing Machinery] \def\@journalNameShort{ACM Trans. Internet Technol.}% \def\@permissionCodeOne{1533-5399}% \or % TOMACS - \def\@journalName{ACM Transactions on Modeling and Computer Simulation}% \def\@journalName{ACM Transactions on Modeling and Computer Simulation}% \def\@journalNameShort{ACM Trans. Model. Comput. Simul.}% \or % TOMM @@ -1019,13 +1074,28 @@ Computing Machinery] \fi} \acmConference[Conference'17]{ACM Conference}{July 2017}{Washington, DC, USA} +\def\acmBooktitle#1{\gdef\@acmBooktitle{#1}} +\acmBooktitle{Proceedings of \acmConference@name + \ifx\acmConference@name\acmConference@shortname\else + \ (\acmConference@shortname)\fi} +\def\@editorsAbbrev{(Ed.)} +\def\@acmEditors{} +\def\editor#1{\ifx\@acmEditors\@empty + \gdef\@acmEditors{#1}% + \else + \gdef\@editorsAbbrev{(Eds.)}% + \g@addto@macro\@acmEditors{\and#1}% +\fi} \def\subtitle#1{\def\@subtitle{#1}} \subtitle{} \newcount\num@authorgroups \num@authorgroups=0\relax +\newcount\num@authors +\num@authors=0\relax \newif\if@insideauthorgroup \@insideauthorgroupfalse \renewcommand\author[2][]{% + \global\advance\num@authors by 1\relax \if@insideauthorgroup\else \global\advance\num@authorgroups by 1\relax \global\@insideauthorgrouptrue @@ -1070,7 +1140,7 @@ Computing Machinery] \g@addto@macro\addresses{\affiliation{#1}{#2}}% \fi} \define@boolkey+{@ACM@affiliation@}[@ACM@affiliation@]{obeypunctuation}% -[true]{}{\ClassError{\@classname}{obeypunctuation must be true or false}} +[true]{}{\ClassError{\@classname}{The option obeypunctuation can be either true or false}} \def\additionalaffiliation#1{\authornote{\@additionalaffiliation{#1}}} \def\@additionalaffiliation#1{\bgroup \def\position##1{\ignorespaces}% @@ -1087,7 +1157,9 @@ Computing Machinery] \if@ACM@anonymous\else \g@addto@macro\addresses{\email{#1}{#2}}% \fi} -\let\orcid\@gobble +\def\orcid#1{\unskip\ignorespaces} +\def\authorsaddresses#1{\def\@authorsaddresses{#1}} +\authorsaddresses{\@mkauthorsaddresses} \def\@titlenotes{} \def\titlenote#1{% \g@addto@macro\@title{\footnotemark}% @@ -1125,7 +1197,7 @@ Computing Machinery] \def\acmNumber#1{\def\@acmNumber{#1}} \acmNumber{1} \def\acmArticle#1{\def\@acmArticle{#1}} -\acmArticle{1} +\acmArticle{} \def\acmArticleSeq#1{\def\@acmArticleSeq{#1}} \acmArticleSeq{\@acmArticle} \def\acmYear#1{\def\@acmYear{#1}} @@ -1176,22 +1248,22 @@ Computing Machinery] \ClassInfo{\@classname}{Printing CCS}% \else \ClassInfo{\@classname}{Suppressing CCS}% - \fi}{\ClassError{\@classname}{printccs must be true or false}} + \fi}{\ClassError{\@classname}{The option printccs can be either true or false}} \define@boolkey+{@ACM@topmatter@}[@ACM@]{printacmref}[true]{% \if@ACM@printacmref \ClassInfo{\@classname}{Printing bibformat}% \else \ClassInfo{\@classname}{Suppressing bibformat}% - \fi}{\ClassError{\@classname}{printacmref must be true or false}} + \fi}{\ClassError{\@classname}{The option printacmref can be either true or false}} \define@boolkey+{@ACM@topmatter@}[@ACM@]{printfolios}[true]{% \if@ACM@printfolios \ClassInfo{\@classname}{Printing folios}% \else \ClassInfo{\@classname}{Suppressing folios}% - \fi}{\ClassError{\@classname}{printfolios must be true or false}} + \fi}{\ClassError{\@classname}{The option printfolios can be either true or false}} \define@cmdkey{@ACM@topmatter@}[@ACM@]{authorsperrow}[0]{% \IfInteger{#1}{\ClassInfo{\@classname}{Setting authorsperrow to - #1}}{\ClassWarning{\@classname}{Parameter authorsperrow must be + #1}}{\ClassWarning{\@classname}{The parameter authorsperrow must be numerical. Ignoring the input #1}\gdef\@ACM@authorsperrow{0}}} \def\settopmatter#1{\setkeys{@ACM@topmatter@}{#1}} \settopmatter{printccs=true, printacmref=true} @@ -1228,16 +1300,28 @@ Computing Machinery] \excludecomment{CCSXML} \let\@concepts\@empty \newcommand\ccsdesc[2][100]{% - \ccsdesc@parse#1~#2~} + \ccsdesc@parse#1~#2~~\ccsdesc@parse@end} \RequirePackage{textcomp} \def\ccsdesc@parse#1~#2~#3~{% - \expandafter\ifx\csname CCS@#2\endcsname\relax - \expandafter\gdef\csname CCS@#2\endcsname{\textbullet\ \textbf{#2} \textrightarrow\ }% - \g@addto@macro{\@concepts}{\csname CCS@#2\endcsname}\fi - \expandafter\g@addto@macro\expandafter{\csname CCS@#2\endcsname}{% - \ifnum#1>499\textbf{#3}; \else - \ifnum#1>299\textit{#3}; \else - #3; \fi\fi}} + \expandafter\ifx\csname CCS@General@#2\endcsname\relax + \expandafter\gdef\csname CCS@General@#2\endcsname{\textbullet\ + \textbf{#2}}% + \expandafter\gdef\csname CCS@Punctuation@#2\endcsname{; }% + \expandafter\gdef\csname CCS@Specific@#2\endcsname{}% + \g@addto@macro{\@concepts}{\csname CCS@General@#2\endcsname + \csname CCS@Punctuation@#2\endcsname + \csname CCS@Specific@#2\endcsname}% + \fi + \ifx#3\relax\relax\else + \expandafter\gdef\csname CCS@Punctuation@#2\endcsname{ + \textrightarrow\ }% + \expandafter\g@addto@macro\expandafter{\csname CCS@Specific@#2\endcsname}{% + \ifnum#1>499\textbf{#3}; \else + \ifnum#1>299\textit{#3}; \else + #3; \fi\fi}% + \fi +\ccsdesc@parse@finish} +\def\ccsdesc@parse@finish#1\ccsdesc@parse@end{} \newif\if@printcopyright \@printcopyrighttrue \newif\if@printpermission @@ -1245,9 +1329,10 @@ Computing Machinery] \newif\if@acmowned \@acmownedtrue \define@choicekey*{ACM@}{acmcopyrightmode}[% - \acm@copyrightinput\acm@copyrightmode]{none,acmcopyright,acmlicensed,% - rightsretained,usgov,usgovmixed,cagov,cagovmixed,% - licensedusgovmixed,licensedcagovmixed,othergov,licensedothergov}{% + \acm@copyrightinput\acm@copyrightmode]{none,% + acmcopyright,acmlicensed,rightsretained,% + usgov,usgovmixed,cagov,cagovmixed,licensedusgovmixed,% + licensedcagov,licensedcagovmixed,othergov,licensedothergov}{% \@printpermissiontrue \@printcopyrighttrue \@acmownedtrue @@ -1275,13 +1360,16 @@ Computing Machinery] \ifnum\acm@copyrightmode=8\relax % licensedusgovmixed \@acmownedfalse \fi - \ifnum\acm@copyrightmode=9\relax % licensedcagovmixed + \ifnum\acm@copyrightmode=9\relax % licensedcagov \@acmownedfalse \fi - \ifnum\acm@copyrightmode=10\relax % othergov + \ifnum\acm@copyrightmode=10\relax % licensedcagovmixed + \@acmownedfalse + \fi + \ifnum\acm@copyrightmode=11\relax % othergov \@acmownedtrue \fi - \ifnum\acm@copyrightmode=11\relax % licensedothergov + \ifnum\acm@copyrightmode=12\relax % licensedothergov \@acmownedfalse \fi} \def\setcopyright#1{\setkeys{ACM@}{acmcopyrightmode=#1}} @@ -1305,6 +1393,9 @@ Computing Machinery] \or %licensedusgovmixed Copyright held by the owner/author(s). Publication rights licensed to Association for Computing Machinery. + \or % licensedcagov + Crown in Right of Canada. Publication rights licensed to + Association for Computing Machinery. \or %licensedcagovmixed Copyright held by the owner/author(s). Publication rights licensed to Association for Computing Machinery. @@ -1355,16 +1446,10 @@ Computing Machinery] source. \or % usgovmixed ACM acknowledges that this contribution was authored or co-authored - by an employee, or contractor of the national government. As such, - the Government retains a nonexclusive, royalty-free right to + by an employee, contractor, or affiliate of the United States government. As such, + the United States government retains a nonexclusive, royalty-free right to publish or reproduce this article, or to allow others to do so, for - Government purposes only. Permission to make digital or hard copies - for personal or classroom use is granted. Copies must bear this - notice and the full citation on the first page. Copyrights for - components of this work owned by others than ACM must be - honored. To copy otherwise, distribute, republish, or post, - requires prior specific permission and\hspace*{.5pt}/or a - fee. Request permissions from permissions@acm.org. + government purposes only. \or % cagov This article was authored by employees of the Government of Canada. As such, the Canadian government retains all interest in the @@ -1375,7 +1460,7 @@ Computing Machinery] Permission to make digital or hard copies for personal or classroom use is granted. Copies must bear this notice and the full citation on the first page. Copyrights for components of this work owned by - others than the Canadain Government must be honored. To copy + others than the Canadian Government must be honored. To copy otherwise, distribute, republish, or post, requires prior specific permission and\hspace*{.5pt}/or a fee. Request permissions from permissions@acm.org. @@ -1398,6 +1483,20 @@ Computing Machinery] Government retains a nonexclusive, royalty-free right to publish or reproduce this article, or to allow others to do so, for Government purposes only. + \or % licensedcagov + This article was authored by employees of the Government of Canada. + As such, the Canadian government retains all interest in the + copyright to this work and grants to ACM a nonexclusive, + royalty-free right to publish or reproduce this article, or to allow + others to do so, provided that clear attribution is given both to + the authors and the Canadian government agency employing them. + Permission to make digital or hard copies for personal or classroom + use is granted. Copies must bear this notice and the full citation + on the first page. Copyrights for components of this work owned by + others than the Canadian Government must be honored. To copy + otherwise, distribute, republish, or post, requires prior specific + permission and\hspace*{.5pt}/or a fee. Request permissions from + permissions@acm.org. \or % licensedcagovmixed Publication rights licensed to ACM\@. ACM acknowledges that this contribution was authored or co-authored by an employee, contractor @@ -1443,7 +1542,7 @@ Computing Machinery] \renewcommand\thefootnote{\@fnsymbol\c@footnote}% \global\@topnum\z@ % this prevents floats from falling % at the top of page 1 - \global\@botnum\z@ % we do not want them to be on bottom either + \global\@botnum\z@ % we do not want them to be on the bottom either \hsize=\textwidth \def\@makefnmark{\hbox{\@textsuperscript{\@thefnmark}}}% \@mktitle\if@ACM@sigchiamode\else\@mkauthors\fi\@mkteasers @@ -1454,12 +1553,21 @@ Computing Machinery] \@titlenotes \@subtitlenotes \@authornotes - \let\@makefnmark\relax \let\@thefnmark\relax + \let\@makefnmark\relax + \let\@thefnmark\relax \let\@makefntext\noindent \ifx\@empty\thankses\else - \footnotetextcopyrightpermission{% + \footnotetextauthorsaddresses{% \def\par{\let\par\@par}\parindent\z@\@setthanks}% \fi + \ifx\@empty\@authorsaddresses\else + \if@ACM@anonymous\else + \if@ACM@journal + \footnotetextauthorsaddresses{% + \def\par{\let\par\@par}\parindent\z@\@setauthorsaddresses}% + \fi + \fi + \fi \footnotetextcopyrightpermission{% \if@ACM@authordraft \raisebox{-2ex}[\z@][\z@]{\makebox[0pt][l]{\large\bfseries @@ -1491,7 +1599,7 @@ Computing Machinery] \if@ACM@journal \emph{\@journalName}% \else - \emph{Proceedings of \acmConference@name, \acmConference@date}% + \emph{\@acmBooktitle}% \fi \ifx\@acmDOI\@empty . @@ -1504,9 +1612,9 @@ Computing Machinery] \ifx\@acmPrice\@empty\else\ \$\@acmPrice\fi\\ \@formatdoi{\@acmDOI}% \else % Conference - ACM~ISBN~\@acmISBN - \ifx\@acmPrice\@empty.\else\dots\$\@acmPrice\fi\\ - \@formatdoi{\@acmDOI}% + \ifx\@acmISBN\@empty\else ACM~ISBN~\@acmISBN + \ifx\@acmPrice\@empty.\else\dots\$\@acmPrice\fi\\\fi + \ifx\@acmDOI\@empty\else\@formatdoi{\@acmDOI}\fi% \fi \fi \fi} @@ -1535,7 +1643,9 @@ Computing Machinery] \@mkbibcitation \fi \hypersetup{pdfauthor={\authors}, - pdftitle={\@title}, pdfkeywords={\@concepts}}% + pdftitle={\@title}, + pdfsubject={\@concepts}, + pdfkeywords={\@keywords}}% \@printendtopmatter \@afterindentfalse \@afterheading @@ -1572,13 +1682,10 @@ Computing Machinery] \ifcase\ACM@format@nr \relax % manuscript \box\mktitle@bx\par - \noindent\hrulefill\par \or % acmsmall \box\mktitle@bx\par - \noindent\hrulefill\par \or % acmlarge \box\mktitle@bx\par - \noindent\hrulefill\par \or % acmtog \twocolumn[\box\mktitle@bx]% \or % sigconf @@ -1630,11 +1737,11 @@ Computing Machinery] \def\@titlefont{% \ifcase\ACM@format@nr \relax % manuscript - \LARGE\bfseries\sffamily + \LARGE\sffamily\bfseries \or % acmsmall - \LARGE\bfseries\sffamily + \LARGE\sffamily\bfseries \or % acmlarge - \LARGE\bfseries\sffamily + \LARGE\sffamily\bfseries \or % acmtog \Huge\sffamily \or % sigconf @@ -1741,24 +1848,22 @@ Computing Machinery] \unskip\cleaders\copy\@ACM@commabox\hskip\wd\@ACM@commabox \fi\fi #1} +\def\streetaddress#1{\unskip\ignorespaces} +\def\postcode#1{\unskip\ignorespaces} \if@ACM@journal - \let\position\@gobble - \def\institution#1{#1\ignorespaces}% - \newcommand\department[2][0]{}% - \let\streetaddress\@gobble - \let\city\@gobble - \let\state\@gobble - \let\postcode\@gobble - \let\country\@gobble + \def\position#1{\unskip\ignorespaces} + \def\institution#1{\unskip~#1\ignorespaces} + \def\city#1{\unskip\ignorespaces} + \def\state#1{\unskip\ignorespaces} + \newcommand\department[2][0]{\unskip\ignorespaces} + \def\country#1{\if@ACM@affiliation@obeypunctuation\else, \fi#1\ignorespaces} \else \def\position#1{\if@ACM@affiliation@obeypunctuation#1\else#1\par\fi}% \def\institution#1{\if@ACM@affiliation@obeypunctuation#1\else#1\par\fi}% \newcommand\department[2][0]{\if@ACM@affiliation@obeypunctuation #2\else#2\par\fi}% - \def\streetaddress#1{\if@ACM@affiliation@obeypunctuation#1\else#1\par\fi}% \let\city\@ACM@addtoaddress \let\state\@ACM@addtoaddress - \def\postcode#1{\if@ACM@affiliation@obeypunctuation#1\else\unskip\space#1\fi}% \let\country\@ACM@addtoaddress \fi \def\@mkauthors{\begingroup @@ -1826,9 +1931,9 @@ Computing Machinery] \global\let\and\@typeset@author@line \def\@author##1{% \ifx\@currentauthors\@empty - \gdef\@currentauthors{\@authorfont\MakeUppercase{##1}}% + \gdef\@currentauthors{\@authorfont\MakeTextUppercase{##1}}% \else - \g@addto@macro{\@currentauthors}{\and\MakeUppercase{##1}}% + \g@addto@macro{\@currentauthors}{\and\MakeTextUppercase{##1}}% \fi \gdef\and{}}% \def\email##1##2{}% @@ -1951,6 +2056,26 @@ Computing Machinery] \par\raggedright\leftskip=\z@ \lineskip=1pc\noindent \addresses\let\and\@typeset@author@bx\and\par\bigskip\egroup} +\def\@mkauthorsaddresses{% + \ifnum\num@authors>1\relax + Authors' \else Author's \fi + \ifnum\num@authorgroups>1\relax + addresses: \else address: \fi + \bgroup + \def\streetaddress##1{\unskip\@addpunct, ##1}% + \def\postcode##1{\unskip\@addpunct, ##1}% + \def\position##1{\unskip\ignorespaces}% + \def\institution##1{\unskip\@addpunct, ##1}% + \def\city##1{\unskip\@addpunct, ##1}% + \def\state##1{\unskip\@addpunct, ##1}% + \renewcommand\department[2][0]{\unskip\@addpunct, ##2}% + \def\country##1{\unskip\@addpunct, ##1}% + \def\and{\unskip\@addpunct; }% + \def\@author##1{##1}% + \def\email##1##2{\unskip\@addpunct, \nolinkurl{##2}}% + \addresses + \egroup} +\def\@setaddresses{} \def\@authornotemark{\g@addto@macro\@currentauthors{\footnotemark\relax}} \def\@@authornotemark#1{\g@addto@macro\@currentauthors{\footnotemark[#1]}} \def\@mkteasers{% @@ -1960,60 +2085,45 @@ Computing Machinery] \global\setbox\mktitle@bx=\vbox{\noindent\box\mktitle@bx\par \noindent\@teaserfigures\par\medskip}% \fi} -\def\@setaddresses{} \def\@mkabstract{\bgroup \ifx\@abstract\@lempty\else {\phantomsection\addcontentsline{toc}{section}{Abstract}% \if@ACM@journal - \small\noindent + \everypar{\setbox\z@\lastbox\everypar{}}\small \else \section*{Abstract}% \fi \ignorespaces\@abstract\par}% \fi\egroup} \def\@mkbibcitation{\bgroup + \def\@pages@word{\ifnum\getrefnumber{TotPages}=1\relax page\else pages\fi}% \def\footnotemark{}% \def\\{\unskip{} \ignorespaces}% \def\footnote{\ClassError{\@classname}{Please do note use footnotes - inside \string\title{} or \string\author{} command! Use + inside a \string\title{} or \string\author{} command! Use \string\titlenote{} or \string\authornote{} instead!}}% - \par\medskip\small\noindent{\bfseries ACM Reference format:}\par\nobreak - \noindent\authors. \@acmYear. \@title. + \def\@article@string{\ifx\@acmArticle\@empty{\ }\else, + Article~\@acmArticle\ \fi}% + \par\medskip\small\noindent{\bfseries ACM Reference Format:}\par\nobreak + \noindent\authors. \@acmYear. \@title + \ifx\@subtitle\@empty. \else: \@subtitle. \fi \if@ACM@journal \textit{\@journalNameShort} - \@acmVolume, \@acmNumber, Article~\@acmArticle\ (\@acmPubDate), - \ref{TotPages}~pages. + \@acmVolume, \@acmNumber \@article@string (\@acmPubDate), + \ref{TotPages}~\@pages@word. \else - In \textit{Proceedings of \acmConference@name, \acmConference@venue, - \acmConference@date - \ifx\acmConference@name\acmConference@shortname\else - \ (\acmConference@shortname)\fi - ,} \ref{TotPages}~pages. - \fi\par - \noindent\@formatdoi{\@acmDOI} -\par\egroup} -\def\@printendtopmatter{\par\medskip - \ifcase\ACM@format@nr - \relax % manuscript - \noindent\hrulefill\par\medskip - \or % acmsmall - \noindent\hrulefill\par\medskip - \or % acmlarge - \noindent\hrulefill\par\medskip - \or % acmtog - \par\bigskip - \or % sigconf - \par\bigskip - \or % siggraph - \par\bigskip - \or % sigplan - \par\bigskip - \or % sigchi - \par\bigskip - \or % sigchi-a + In \textit{\@acmBooktitle}% + \ifx\@acmEditors\@empty\textit{.}\else + \andify\@acmEditors\textit{, }\@acmEditors~\@editorsAbbrev.% + \fi\ + ACM, New York, NY, USA% + \@article@string\unskip, \ref{TotPages}~\@pages@word. \fi -} + \@formatdoi{\@acmDOI} +\par\egroup} +\def\@printendtopmatter{\par\bigskip} \def\@setthanks{\long\def\thanks##1{\par##1\@addpunct.}\thankses} +\def\@setauthorsaddresses{\@authorsaddresses\unskip\@addpunct.} \RequirePackage{fancyhdr} \if@ACM@review \newsavebox{\ACM@linecount@bx} @@ -2022,11 +2132,13 @@ Computing Machinery] \ACM@linecount\@ne\relax \def\ACM@mk@linecount{% \savebox{\ACM@linecount@bx}[4em][t]{\parbox[t]{4em}{% - \setlength{\ACM@linecount@bxht}{-\baselineskip}% - \loop{\color{ACMRed}\scriptsize\the\ACM@linecount}\\ + \setlength{\ACM@linecount@bxht}{0pt}% + \loop{\color{red}\scriptsize\the\ACM@linecount}\\ \global\advance\ACM@linecount by \@ne \addtolength{\ACM@linecount@bxht}{\baselineskip}% - \ifdim\ACM@linecount@bxht<\textheight\repeat}}} + \ifdim\ACM@linecount@bxht<\textheight\repeat + {\color{red}\scriptsize\the\ACM@linecount}\hfill + \global\advance\ACM@linecount by \@ne}}} \fi \def\ACM@linecountL{% \if@ACM@review @@ -2043,7 +2155,7 @@ Computing Machinery] \end{picture}% \fi} \if@ACM@timestamp - % Subtracting 30 from \time gives us the effect of rounding-down despite + % Subtracting 30 from \time gives us the effect of rounding down despite % \numexpr rounding to nearest \newcounter{ACM@time@hours} \setcounter{ACM@time@hours}{\numexpr (\time - 30) / 60 \relax} @@ -2051,36 +2163,16 @@ Computing Machinery] \setcounter{ACM@time@minutes}{\numexpr \time - \theACM@time@hours * 60 \relax} \newcommand\ACM@timestamp{% \footnotesize% - \the\year-\two@digits{\the\month}-\two@digits{\the\day}{ }% - \two@digits{\theACM@time@hours}:\two@digits{\theACM@time@minutes}{ }% - page~\thepage\ (pp. \@startPage-\pageref*{TotPages})% \ifx\@acmSubmissionID\@empty\relax\else - ~Submission~ID: \@acmSubmissionID + Submission ID: \@acmSubmissionID.{ }% \fi + \the\year-\two@digits{\the\month}-\two@digits{\the\day}{ }% + \two@digits{\theACM@time@hours}:\two@digits{\theACM@time@minutes}{. }% + Page \thepage\ of \@startPage--\pageref*{TotPages}.% } \fi \def\@shortauthors{\if@ACM@anonymous Anon.\else\shortauthors\fi} -\def\@headfootfont{% - \ifcase\ACM@format@nr - \relax % manuscript - \sffamily - \or % acmsmall - \sffamily - \or % acmlarge - \sffamily - \or % acmtog - \sffamily - \or % sigconf - \sffamily - \or % siggraph - \sffamily - \or % sigplan - \sffamily - \or % sigchi - \sffamily - \or % sigchi-a - \sffamily - \fi} +\def\@headfootfont{\sffamily} \fancypagestyle{standardpagestyle}{% \fancyhf{}% \renewcommand{\headrulewidth}{\z@}% @@ -2153,7 +2245,8 @@ Computing Machinery] \@folio@voffset=.55in\relax \def\@folio@max{10} \fi -\def\@folioblob{\@tempcnta=\@acmArticleSeq\relax +\def\@folioblob{\@tempcnta=0\@acmArticleSeq\relax + \ifnum\@tempcnta=0\relax\else \loop \ifnum\@tempcnta>\@folio@max\relax \advance\@tempcnta by - \@folio@max @@ -2169,8 +2262,8 @@ Computing Machinery] \rule{\@folio@wd}{\@folio@ht}}}% \parbox{\@folio@wd}{% \centering - \textcolor{white}{\LARGE\bfseries\sffamily\@acmArticle}}}} - \end{picture}} + \textcolor{white}{\LARGE\sffamily\bfseries\@acmArticle}}}} + \end{picture}\fi} \fancypagestyle{firstpagestyle}{% \fancyhf{}% @@ -2217,6 +2310,14 @@ Computing Machinery] \fi \fi } +\let\ACM@ps@plain\ps@plain +\let\ACM@ps@myheadings\ps@myheadings +\let\ACM@ps@headings\ps@headings +\def\ACM@restore@pagestyle{% + \let\ps@plain\ACM@ps@plain + \let\ps@myheadings\ACM@ps@myheadings + \let\ps@headings\ACM@ps@headings} +\AtBeginDocument{\ACM@restore@pagestyle} \renewcommand\section{\@startsection{section}{1}{\z@}% {-.75\baselineskip \@plus -2\p@ \@minus -.2\p@}% {.25\baselineskip}% @@ -2241,7 +2342,7 @@ Computing Machinery] \rightskip\@rightskip \leftskip\z@skip \parindent\z@} -\def\@secfont{\sffamily\bfseries\section@raggedright\MakeUppercase} +\def\@secfont{\sffamily\bfseries\section@raggedright\MakeTextUppercase} \def\@subsecfont{\sffamily\bfseries\section@raggedright} \def\@subsubsecfont{\sffamily\itshape} \def\@parfont{\itshape} @@ -2250,17 +2351,17 @@ Computing Machinery] \relax % manuscript \or % acmsmall \or % acmlarge - \def\@secfont{\sffamily\large\section@raggedright\MakeUppercase} + \def\@secfont{\sffamily\large\section@raggedright\MakeTextUppercase} \def\@subsecfont{\sffamily\large\section@raggedright} \or % acmtog - \def\@secfont{\sffamily\large\section@raggedright\MakeUppercase} + \def\@secfont{\sffamily\large\section@raggedright\MakeTextUppercase} \def\@subsecfont{\sffamily\large\section@raggedright} \or % sigconf - \def\@secfont{\bfseries\Large\section@raggedright\MakeUppercase} + \def\@secfont{\bfseries\Large\section@raggedright\MakeTextUppercase} \def\@subsecfont{\bfseries\Large\section@raggedright} \or % siggraph - \def\@secfont{\bfseries\sffamily\Large\section@raggedright\MakeUppercase} - \def\@subsecfont{\bfseries\sffamily\Large\section@raggedright} + \def\@secfont{\sffamily\bfseries\Large\section@raggedright\MakeTextUppercase} + \def\@subsecfont{\sffamily\bfseries\Large\section@raggedright} \or % sigplan \def\@secfont{\bfseries\Large\section@raggedright} \def\@subsecfont{\bfseries\section@raggedright} @@ -2281,12 +2382,12 @@ Computing Machinery] \def\@subparfont{\itshape} \or % sigchi \setcounter{secnumdepth}{1} - \def\@secfont{\bfseries\sffamily\section@raggedright\MakeUppercase} - \def\@subsecfont{\bfseries\sffamily\section@raggedright} + \def\@secfont{\sffamily\bfseries\section@raggedright\MakeTextUppercase} + \def\@subsecfont{\sffamily\bfseries\section@raggedright} \or % sigchi-a \setcounter{secnumdepth}{0} - \def\@secfont{\bfseries\sffamily\section@raggedright\MakeUppercase} - \def\@subsecfont{\bfseries\sffamily\section@raggedright} + \def\@secfont{\sffamily\bfseries\section@raggedright\MakeTextUppercase} + \def\@subsecfont{\sffamily\bfseries\section@raggedright} \fi \def\@adddotafter#1{#1\@addpunct{.}} \def\@addspaceafter#1{#1\@addpunct{\enspace}} @@ -2352,15 +2453,33 @@ Computing Machinery] {.5em}% spacing after head {\thmname{#1}\thmnumber{ #2}\thmnote{ {\@acmdefinitionnotefont(#3)}}}% head spec \theoremstyle{acmplain} -\newtheorem{theorem}{Theorem}[section] -\newtheorem{conjecture}[theorem]{Conjecture} -\newtheorem{proposition}[theorem]{Proposition} -\newtheorem{lemma}[theorem]{Lemma} -\newtheorem{corollary}[theorem]{Corollary} -\theoremstyle{acmdefinition} -\newtheorem{example}[theorem]{Example} -\newtheorem{definition}[theorem]{Definition} -\theoremstyle{acmplain} +\AtEndPreamble{% + \if@ACM@acmthm + \theoremstyle{acmplain} + \@ifundefined{theorem}{% + \newtheorem{theorem}{Theorem}[section] + }{} + \@ifundefined{conjecture}{% + \newtheorem{conjecture}[theorem]{Conjecture} + }{} + \@ifundefined{proposition}{% + \newtheorem{proposition}[theorem]{Proposition} + }{} + \newtheorem{lemma}[theorem]{Lemma} + \@ifundefined{lemma}{}{} + \@ifundefined{corollary}{% + \newtheorem{corollary}[theorem]{Corollary} + }{} + \theoremstyle{acmdefinition} + \@ifundefined{example}{% + \newtheorem{example}[theorem]{Example} + }{} + \@ifundefined{definition}{% + \newtheorem{definition}[theorem]{Definition} + }{} + \fi + \theoremstyle{acmplain} +} \def\@proofnamefont{\scshape} \def\@proofindent{\indent} \ifcase\ACM@format@nr @@ -2395,6 +2514,7 @@ Computing Machinery] \def\grantsponsor#1#2#3{#2} \newcommand\grantnum[3][]{#3% \def\@tempa{#1}\ifx\@tempa\@empty\else\space(\url{#1})\fi} +\AtEndPreamble{% \if@ACM@screen \includecomment{screenonly} \excludecomment{printonly} @@ -2407,7 +2527,7 @@ Computing Machinery] \excludecomment{acks} \else \includecomment{anonsuppress} -\fi +\fi} \newcommand\showeprint[2][arxiv]{% \def\@tempa{#1}% \ifx\@tempa\@empty\def\@tempa{arxiv}\fi diff --git a/scribble-lib/scribble/acmart/acmart.tex b/scribble-lib/scribble/acmart/acmart.tex index d0ac2a65..f306bc88 100644 --- a/scribble-lib/scribble/acmart/acmart.tex +++ b/scribble-lib/scribble/acmart/acmart.tex @@ -23,4 +23,6 @@ % Normally gets re-written by the title macro: \newcommand{\SSubtitle}[1]{{\bf #1}} - +% Use ACM color; it would be better to use `citecolor` here somehow, +% but I can't figure out how to do that +\newcommand{\AutobibLink}[1]{\color{ACMPurple}{#1}} diff --git a/scribble-lib/scribble/acmart/lang.rkt b/scribble-lib/scribble/acmart/lang.rkt index e2a2a5da..e8755f50 100644 --- a/scribble-lib/scribble/acmart/lang.rkt +++ b/scribble-lib/scribble/acmart/lang.rkt @@ -142,8 +142,16 @@ #:replacements (hash "scribble-load-replace.tex" (scribble-file "acmart/acmart-load.tex")))))) (define (add-acmart-styles doc) - ;; Ensure that "acmart.tex" is used, since "style.tex" - ;; re-defines commands. - (struct-copy part doc [to-collect - (cons invisible-element-to-collect-for-acmart-extras - (part-to-collect doc))])) + (struct-copy part doc + [to-collect + ;; Ensure that "acmart.tex" is used, since "style.tex" + ;; re-defines commands. + (cons invisible-element-to-collect-for-acmart-extras + (part-to-collect doc))] + [style (let ([s (part-style doc)]) + (struct-copy style s + [properties + ;; Immitate Latex-based links where only the + ;; number part is hyperlinked. + (cons (link-render-style 'number) + (style-properties s))]))])) diff --git a/scribble-lib/scribble/base-render.rkt b/scribble-lib/scribble/base-render.rkt index 7adf532e..8d774514 100644 --- a/scribble-lib/scribble/base-render.rkt +++ b/scribble-lib/scribble/base-render.rkt @@ -39,6 +39,7 @@ render-nested-flow render-block render-other + link-render-style-at-element get-dest-directory format-number number-depth)) @@ -606,17 +607,28 @@ number)) sub-pos sub-numberers)) + (define unnumbered-and-unnumbered-subsections? + (and (not sub-grouper?) + ;; If this section wasn't marked with + ;; 'grouper but is unnumbered and doesn't + ;; have numbered subsections, then didn't + ;; reset counters, so propagate the old + ;; position + (and unnumbered? + (= next-sub-pos sub-pos)))) (loop (cdr parts) (if (or unnumbered? numberer) pos (add1 pos)) next-numberers - (if sub-grouper? - next-sub-pos - 1) - (if sub-grouper? - next-sub-numberers - #hash()))))))) + (cond + [sub-grouper? next-sub-pos] + [unnumbered-and-unnumbered-subsections? sub-pos] + [else 1]) + (cond + [sub-grouper? next-sub-numberers] + [unnumbered-and-unnumbered-subsections? sub-numberers] + [else #hash()]))))))) (let ([prefix (part-tag-prefix d)]) (for ([(k v) (collect-info-ht p-ci)]) (when (cadr k) @@ -737,7 +749,8 @@ (define/public (resolve-part d ri) (parameterize ([current-tag-prefixes - (extend-prefix d (fresh-tag-resolve-context? d ri))]) + (extend-prefix d (fresh-tag-resolve-context? d ri))] + [current-link-render-style (part-render-style d)]) (when (part-title-content d) (resolve-content (part-title-content d) d ri)) (resolve-flow (part-blocks d) d ri) @@ -811,6 +824,15 @@ [(multiarg-element? i) (resolve-content (multiarg-element-contents i) d ri)])) + (define/public (link-render-style-at-element e) + (link-render-style-mode + (or (let ([s (element-style e)]) + (and (style? s) + (for/or ([p (in-list (style-properties s))] + #:when (link-render-style? p)) + p))) + (current-link-render-style)))) + ;; ---------------------------------------- ;; render methods @@ -871,9 +893,16 @@ (define/public (render-part d ri) (parameterize ([current-tag-prefixes - (extend-prefix d (fresh-tag-render-context? d ri))]) + (extend-prefix d (fresh-tag-render-context? d ri))] + [current-link-render-style (part-render-style d)]) (render-part-content d ri))) + (define/private (part-render-style d) + (or (for/or ([p (in-list (style-properties (part-style d)))] + #:when (link-render-style? p)) + p) + (current-link-render-style))) + (define/public (render-part-content d ri) (list (when (part-title-content d) @@ -962,7 +991,11 @@ (render-content (traverse-element-content i ri) part ri)] [(part-relative-element? i) (render-content (part-relative-element-content i ri) part ri)] - [(convertible? i) (list "???")] + [(convertible? i) + (define s (convert i 'text)) + (if (string? s) + (render-other s part ri) + (render-other (format "~s" i) part ri))] [else (render-other i part ri)])) (define/public (render-other i part ri) diff --git a/scribble-lib/scribble/base.rkt b/scribble-lib/scribble/base.rkt index 6432058c..e57ef3b7 100644 --- a/scribble-lib/scribble/base.rkt +++ b/scribble-lib/scribble/base.rkt @@ -549,45 +549,55 @@ ;; ---------------------------------------- -(provide/contract - [elemtag (->* ((or/c taglet? generated-tag?)) - () - #:rest (listof pre-content?) - element?)] - [elemref (->* ((or/c taglet? generated-tag?)) - (#:underline? any/c) - #:rest (listof pre-content?) - element?)] - [secref (->* (string?) - (#:doc module-path? - #:tag-prefixes (or/c #f (listof string?)) - #:underline? any/c) - element?)] - [Secref (->* (string?) - (#:doc module-path? - #:tag-prefixes (or/c #f (listof string?)) - #:underline? any/c) - element?)] - [seclink (->* (string?) +(provide + (contract-out + [elemtag (->* ((or/c taglet? generated-tag?)) + () + #:rest (listof pre-content?) + element?)] + [elemref (->* ((or/c taglet? generated-tag?)) + (#:underline? any/c) + #:rest (listof pre-content?) + element?)] + [secref (->* (string?) (#:doc module-path? - #:tag-prefixes (or/c #f (listof string?)) - #:underline? any/c - #:indirect? any/c) - #:rest (listof pre-content?) + #:tag-prefixes (or/c #f (listof string?)) + #:underline? any/c + #:link-render-style (or/c #f link-render-style?)) element?)] - [other-doc (->* (module-path?) - (#:underline? any/c - #:indirect (or/c #f content?)) - element?)]) + [Secref (->* (string?) + (#:doc module-path? + #:tag-prefixes (or/c #f (listof string?)) + #:underline? any/c + #:link-render-style (or/c #f link-render-style?)) + element?)] + [seclink (->* (string?) + (#:doc module-path? + #:tag-prefixes (or/c #f (listof string?)) + #:underline? any/c + #:indirect? any/c) + #:rest (listof pre-content?) + element?)] + [other-doc (->* (module-path?) + (#:underline? any/c + #:indirect (or/c #f content?)) + element?)])) (define (elemtag t . body) (make-target-element #f (decode-content body) `(elem ,t))) (define (elemref #:underline? [u? #t] t . body) (make-link-element (if u? #f "plainlink") (decode-content body) `(elem ,t))) -(define (secref s #:underline? [u? #t] #:doc [doc #f] #:tag-prefixes [prefix #f]) - (make-link-element (if u? #f "plainlink") null (make-section-tag s #:doc doc #:tag-prefixes prefix))) -(define (Secref s #:underline? [u? #t] #:doc [doc #f] #:tag-prefixes [prefix #f]) +(define (secref s #:underline? [u? #t] #:doc [doc #f] #:tag-prefixes [prefix #f] + #:link-render-style [link-style #f]) + (make-link-element (let ([name (if u? #f "plainlink")]) + (if link-style + (style name (list link-style)) + name)) + null + (make-section-tag s #:doc doc #:tag-prefixes prefix))) +(define (Secref s #:underline? [u? #t] #:doc [doc #f] #:tag-prefixes [prefix #f] + #:link-render-style [link-style #f]) (let ([le (secref s #:underline? u? #:doc doc #:tag-prefixes prefix)]) (make-link-element (make-style (element-style le) '(uppercase)) diff --git a/scribble-lib/scribble/core.rkt b/scribble-lib/scribble/core.rkt index 9bb87319..69714a22 100644 --- a/scribble-lib/scribble/core.rkt +++ b/scribble-lib/scribble/core.rkt @@ -162,6 +162,36 @@ ;; ---------------------------------------- +(define-struct link-render-style (mode) + #:constructor-name link-render-style + #:property + prop:serializable + (make-serialize-info + (lambda (s) + (vector (link-render-style-mode s))) + #'deserialize-link-render-style + #f + (or (current-load-relative-directory) (current-directory)))) + +(provide deserialize-link-render-style) +(define deserialize-link-render-style + (make-deserialize-info (lambda (s) + (link-render-style s)) + (lambda (tag init-val) + (error "cannot allocate link-render-style for cycle")))) + +(define current-link-render-style (make-parameter (link-render-style 'default))) + +(provide + link-render-style? + link-render-style-mode + (contract-out + [link-render-style ((or/c 'default 'number) + . -> . link-render-style?)] + [current-link-render-style (parameter/c link-render-style?)])) + +;; ---------------------------------------- + (define-struct numberer (tag step-proc initial-value) #:constructor-name numberer #:property diff --git a/scribble-lib/scribble/decode.rkt b/scribble-lib/scribble/decode.rkt index 463845b9..966804a2 100644 --- a/scribble-lib/scribble/decode.rkt +++ b/scribble-lib/scribble/decode.rkt @@ -166,8 +166,9 @@ #f)) keys k-tags) colls)]) - (if (and title - (not (memq 'hidden (style-properties style)))) + (if (and title + (not (memq 'hidden (style-properties style))) + (not (memq 'no-index (style-properties style)))) (cons (make-index-element #f null (car tags) (list (clean-up-index-string @@ -258,9 +259,6 @@ [(list? (car l)) (loop (append (car l) (cdr l)) next? keys colls accum title tag-prefix tags vers style)] - [(null? (cdr l)) - (loop null #f keys colls (cons (car l) accum) title tag-prefix tags - vers style)] [(part-index-decl? (car l)) (loop (cdr l) next? (cons (car l) keys) colls accum title tag-prefix tags vers style)] @@ -272,6 +270,9 @@ (loop (cdr l) next? keys colls accum title tag-prefix (append tags (list (part-tag-decl-tag (car l)))) vers style)] + [(null? (cdr l)) + (loop null #f keys colls (cons (car l) accum) title tag-prefix tags + vers style)] [(and (pair? (cdr l)) (or (splice? (cadr l)) (list? (cadr l)))) diff --git a/scribble-lib/scribble/eval.rkt b/scribble-lib/scribble/eval.rkt index 7c41aac2..2df5beba 100644 --- a/scribble-lib/scribble/eval.rkt +++ b/scribble-lib/scribble/eval.rkt @@ -44,7 +44,7 @@ (-> any/c any)] [scribble-exn->string - (-> any/c string?)] + (parameter/c (-> any/c string?))] [scribble-eval-handler (parameter/c (-> (-> any/c any) boolean? any/c any))] [make-log-based-eval diff --git a/scribble-lib/scribble/html-render.rkt b/scribble-lib/scribble/html-render.rkt index 721e1001..89e8517a 100644 --- a/scribble-lib/scribble/html-render.rkt +++ b/scribble-lib/scribble/html-render.rkt @@ -277,7 +277,8 @@ extract-part-style-files extract-version extract-authors - extract-pretitle) + extract-pretitle + link-render-style-at-element) (inherit-field prefix-file style-file style-extra-files image-preferences) (init-field [alt-paths null] @@ -373,7 +374,7 @@ (collect-put! ci key (let ([v (vector (or (part-title-content d) '("???")) (add-current-tag-prefix key) - number ; for consistency with base + number (and (current-output-file) (path->relative (current-output-file))) (current-part-whole-page? d))]) @@ -407,6 +408,8 @@ (vector-ref dest 3)) (define (dest-title dest) (vector-ref dest 0)) + (define (dest-number dest) + (vector-ref dest 2)) (define (dest-page? dest) (vector-ref dest 4)) (define (dest-anchor dest) @@ -1341,13 +1344,31 @@ [(and (link-element? e) (not (current-no-links))) (parameterize ([current-no-links #t]) (define indirect-link? (link-element-indirect? e)) - (let-values ([(dest ext-id) - (if (and indirect-link? - external-tag-path) - (values #f #f) - (resolve-get/ext-id part ri (link-element-tag e)))]) + (let*-values ([(dest ext-id) + (if (and indirect-link? + external-tag-path) + (values #f #f) + (resolve-get/ext-id part ri (link-element-tag e)))] + [(number-link?) + (and dest + (not ext-id) + (let ([n (dest-number dest)]) + ;; If the section number is empty, don't generate an + ;; empty link: + (not (or (not n) + (string=? "" (apply string-append (format-number n '(""))))))) + (eq? 'number (link-render-style-at-element e)) + (empty-content? (element-content e)))]) + (if (or indirect-link? dest) - `((a ([href + `(,@(cond + [number-link? + `(,(if (let ([s (element-style e)]) + (and (style? s) (memq 'uppercase (style-properties s)))) + "Section " + "section "))] + [else '()]) + (a ([href ,(cond [(and ext-id external-root-url dest (let* ([ref-path (relative->path (dest-path dest))] @@ -1401,7 +1422,10 @@ null)) [data-pltdoc "x"]) ,@(if (empty-content? (element-content e)) - (render-content (strip-aux (dest-title dest)) part ri) + (cond + [number-link? (format-number (dest-number dest) '(""))] + [else + (render-content (strip-aux (dest-title dest)) part ri)]) (render-content (element-content e) part ri)))) (begin (when #f @@ -2013,9 +2037,9 @@ (loop (cdr path) (cdr root))))))))) (define (from-root p d) - (define c-p (path->complete-path p)) + (define c-p (simplify-path (path->complete-path p))) (define e-p (explode c-p)) - (define e-d (and d (explode (path->complete-path d)))) + (define e-d (and d (explode (simplify-path (path->complete-path d))))) (define p-in? (in-plt? e-p)) (define d-in? (and d (in-plt? e-d))) (define (normalize p) (normal-case-path p)) diff --git a/scribble-lib/scribble/latex-render.rkt b/scribble-lib/scribble/latex-render.rkt index 794f1b72..2491839d 100644 --- a/scribble-lib/scribble/latex-render.rkt +++ b/scribble-lib/scribble/latex-render.rkt @@ -21,6 +21,7 @@ (define disable-images (make-parameter #f)) (define escape-brackets (make-parameter #f)) (define suppress-newline-content (make-parameter #f)) +(define disable-hyperref (make-parameter #f)) (define-struct (toc-paragraph paragraph) ()) @@ -81,7 +82,8 @@ extract-version extract-date extract-authors - extract-pretitle-content) + extract-pretitle-content + link-render-style-at-element) (define/public (extract-short-title d) (ormap (lambda (v) @@ -243,12 +245,14 @@ (printf "{") (show-number) (parameterize ([disable-images #t] - [escape-brackets #t]) + [escape-brackets #t] + [disable-hyperref #t]) (render-content (part-title-content d) d ri)) (printf "}")) (printf "{") (show-number) - (render-content (part-title-content d) d ri) + (parameterize ([disable-hyperref #t]) + (render-content (part-title-content d) d ri)) (printf "}") (when (and (part-style? d 'hidden-number) (not (part-style? d 'unnumbered))) @@ -344,13 +348,15 @@ (format-number number null))] [lbl? (and dest (not ext?) - (not (show-link-page-numbers)))]) + (not (show-link-page-numbers)))] + [link-number? (and lbl? + (eq? 'number (link-render-style-at-element e)))]) (printf "\\~aRef~a~a~a{" (case (and dest (number-depth number)) [(0) "Book"] [(1) (if (string? (car number)) "Part" "Chap")] [else "Sec"]) - (if lbl? + (if (and lbl? (not link-number?)) "Local" "") (if (let ([s (element-style e)]) @@ -360,9 +366,10 @@ (if (null? formatted-number) "UN" "")) - (when lbl? + (when (and lbl? (not link-number?)) (printf "t:~a}{" (t-encode (vector-ref dest 1)))) (unless (null? formatted-number) + (when link-number? (printf "\\SectionNumberLink{t:~a}{" (t-encode (vector-ref dest 1)))) (render-content (if dest (if (list? number) @@ -373,6 +380,7 @@ '("!!!"))) (list "???")) part ri) + (when link-number? (printf "}")) (printf "}{")))) (let* ([es (cond [(element? e) (element-style e)] @@ -382,6 +390,11 @@ (style-name es) es)] [style (and (style? es) es)] + [hyperref? (and (not part-label?) + (link-element? e) + (not (disable-hyperref)) + (let-values ([(dest ext?) (resolve-get/ext? part ri (link-element-tag e))]) + (and dest (not ext?))))] [check-render (lambda () (when (render-element? e) @@ -520,9 +533,15 @@ (wrap e style-name 'exact)] [else (core-render e tt?)])) + (when hyperref? + (printf "\\hyperref[t:~a]{" + (t-encode (link-element-tag e)))) (let loop ([l (if style (style-properties style) null)] [tt? #f]) (if (null? l) - (finish tt?) + (if hyperref? + (parameterize ([disable-hyperref #t]) + (finish tt?)) + (finish tt?)) (let ([v (car l)]) (cond [(target-url? v) @@ -560,7 +579,9 @@ (loop (cdr l) tt?) (for ([l (in-list (command-extras-arguments (car l)))]) (printf "{~a}" l))] - [else (loop (cdr l) tt?)])))))) + [else (loop (cdr l) tt?)])))) + (when hyperref? + (printf "}")))) (when part-label? (printf "}")) (when (and (link-element? e) @@ -1116,8 +1137,8 @@ [(#\ϑ) "$\\vartheta$"] [(#\τ) "$\\tau$"] [(#\υ) "$\\upsilon$"] - [(#\φ) "$\\phi$"] - [(#\ϕ) "$\\varphi$"] + [(#\φ) "$\\varphi$"] + [(#\ϕ) "$\\phi$"] [(#\δ) "$\\delta$"] [(#\ρ) "$\\rho$"] [(#\ϱ) "$\\varrho$"] diff --git a/scribble-lib/scribble/manual-style.css b/scribble-lib/scribble/manual-style.css index 1327c9ae..608d2fb7 100644 --- a/scribble-lib/scribble/manual-style.css +++ b/scribble-lib/scribble/manual-style.css @@ -263,6 +263,10 @@ a:hover { font-size: 0.8rem; } +/* Default to local view. Global will specialize */ +.plt_global_only { display: none; } +.plt_local_only { display: block; } + /* ---------------------------------------- */ /* Version */ @@ -739,4 +743,4 @@ blockquote > blockquote.SVInsetFlow { margin-right: 13em; margin-left: 0; } -} \ No newline at end of file +} diff --git a/scribble-lib/scribble/private/manual-mod.rkt b/scribble-lib/scribble/private/manual-mod.rkt index 7f3035a4..10c4a1c6 100644 --- a/scribble-lib/scribble/private/manual-mod.rkt +++ b/scribble-lib/scribble/private/manual-mod.rkt @@ -11,6 +11,7 @@ setup/main-collects pkg/path racket/list + scribble/html-properties (for-syntax scheme/base syntax/parse) (for-label scheme/base)) @@ -201,6 +202,21 @@ (list pkg) null))) +;; mflatt thinks this should not be exposed +(define (racketpkgname pkg) + (link + ;; XXX Look at (pkg-info-orig-pkg (hash-ref (read-pkgs-db scope) + ;; pkg)) and only show link if catalog? Or did mflatt have + ;; something else in mind? But I'd have to know the scope and pass + ;; that down from compute-packages + (format "https://pkgs.racket-lang.org/package/~a" pkg) + (tt pkg) + #:style (make-style #f + (list "plainlink" + (hover-property + (format "Install this package using `raco pkg install ~a`" + pkg)))))) + (define (*defmodule names modpaths module-path packages link-target? lang content req) (let ([modpaths (or modpaths names)]) (define pkg-spec @@ -218,7 +234,8 @@ "" "s"))) " " - (add-between (map tt pkgs) ", ")))))))))) + (add-between (map racketpkgname pkgs) + ", ")))))))))) (define (flow-width f) (apply max (map block-width f))) (define libs-specs ;; make-desc : element -> flow diff --git a/scribble-lib/scribble/scribble.tex b/scribble-lib/scribble/scribble.tex index c74d04c7..5a32775f 100644 --- a/scribble-lib/scribble/scribble.tex +++ b/scribble-lib/scribble/scribble.tex @@ -59,13 +59,15 @@ \newcommand{\BookRefLocalUN}[2]{\hyperref[#1]{\BookRefUN{#2}}} \newcommand{\ChapRefLocalUN}[2]{\SecRefLocalUN{#1}{#2}} -\newcommand{\SecRefLocalUN}[2]{\SecRefUN{#2} on page~\pageref{#1}} +\newcommand{\SecRefLocalUN}[2]{\hyperref[#1]{\SecRefUN{#2}}} \newcommand{\PartRefLocalUN}[2]{\SecRefLocalUN{#1}{#2}} \newcommand{\BookRefLocalUCUN}[2]{\BookRefLocalUN{#1}{#2}} \newcommand{\ChapRefLocalUCUN}[2]{\ChapRefLocalUN{#1}{#2}} \newcommand{\SecRefLocalUCUN}[2]{\SecRefLocalUN{#1}{#2}} \newcommand{\PartRefLocalUCUN}[2]{\PartRefLocalUN{#1}{#2}} +\newcommand{\SectionNumberLink}[2]{\hyperref[#1]{#2}} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Fonts diff --git a/scribble-lib/scribble/valid-blueboxes-info.rkt b/scribble-lib/scribble/valid-blueboxes-info.rkt index 7b657e0d..d26f657a 100644 --- a/scribble-lib/scribble/valid-blueboxes-info.rkt +++ b/scribble-lib/scribble/valid-blueboxes-info.rkt @@ -7,8 +7,6 @@ (define valid-blueboxes-info? (hash/c tag? - (listof (cons/dc [hd exact-nonnegative-integer?] - [tl (hd) (and/c exact-nonnegative-integer? - (>/c hd))] - #:flat)) + (listof (cons/c exact-nonnegative-integer? + exact-nonnegative-integer?)) #:flat? #t)) diff --git a/scribble-lib/scriblib/autobib.rkt b/scribble-lib/scriblib/autobib.rkt index 4d102b71..33a6ba41 100644 --- a/scribble-lib/scriblib/autobib.rkt +++ b/scribble-lib/scriblib/autobib.rkt @@ -14,7 +14,7 @@ racket/contract) (provide define-cite - author+date-style number-style + author+date-style author+date-square-bracket-style number-style make-bib in-bib (rename-out [auto-bib? bib?]) author-name org-author-name (contract-out @@ -70,26 +70,28 @@ (lambda (renderer part ri) ;; (list which key) should be mapped to the bibliography element. (define s (resolve-get part ri `(,which ,key))) - (make-link-element #f - (list (or s "???") - (cond [(not (send style disambiguate-date?)) '()] - [disambiguation ;; should be a list of bib-entries with same author/date - (define disambiguation* - (add-between (for/list ([bib (in-list disambiguation)]) - (define key (auto-bib-key bib)) - (define maybe-disambiguation - (resolve-get part ri `(autobib-disambiguation ,key))) - (case maybe-disambiguation - [(#f) #f] - [(unambiguous) #f] - [else (make-link-element #f maybe-disambiguation `(autobib ,key))])) - ",")) - (cond [(not (car disambiguation*)) '()] ;; the bib was unambiguous - [else disambiguation*])] - [else '()]) - (if with-specific? - (auto-bib-specific bib-entry) - "")) + (define content + (list (or s "???") + (cond [(not (send style disambiguate-date?)) '()] + [disambiguation ;; should be a list of bib-entries with same author/date + (define disambiguation* + (add-between (for/list ([bib (in-list disambiguation)]) + (define key (auto-bib-key bib)) + (define maybe-disambiguation + (resolve-get part ri `(autobib-disambiguation ,key))) + (case maybe-disambiguation + [(#f) #f] + [(unambiguous) #f] + [else (make-link-element "AutobibLink" maybe-disambiguation `(autobib ,key))])) + ",")) + (cond [(not (car disambiguation*)) '()] ;; the bib was unambiguous + [else disambiguation*])] + [else '()]) + (if with-specific? + (auto-bib-specific bib-entry) + ""))) + (make-link-element "AutobibLink" + content `(autobib ,(auto-bib-key bib-entry)))) (lambda () "(???)") (lambda () "(???)")))) @@ -138,7 +140,7 @@ (error 'citet "citet must be used with identical authors, given ~a" (map (compose author-element-names* auto-bib-author) bib-entries))) (make-element - #f + (make-style "Autobibref" '()) (list (add-cite group (car bib-entries) 'autobib-author #f #f style) 'nbsp (send style get-cite-open) @@ -155,7 +157,7 @@ (values (hash-update h k (lambda (cur) (cons b cur)) null) (cons k (remove k ks)))))) (make-element - #f + (make-style "Autobibref" '()) (append (list 'nbsp (send style get-cite-open)) (add-between @@ -195,20 +197,28 @@ (error 'default-disambiguation "Citations too ambiguous for default disambiguation scheme.")) (make-element #f (list (format "~a" (integer->char (+ 97 n)))))) -(define author+date-style +(define author+date-style% + (class object% + (define/public (bibliography-table-style) bib-single-style) + (define/public (entry-style) bibentry-style) + (define/public (disambiguate-date?) #t) + (define/public (collapse-for-date?) #t) + (define/public (get-cite-open) "(") + (define/public (get-cite-close) ")") + (define/public (get-group-sep) "; ") + (define/public (get-item-sep) ", ") + (define/public (render-citation date-cite i) date-cite) + (define/public (render-author+dates author dates) (list* author " " dates)) + (define/public (bibliography-line i e) (list e)) + (super-new))) + +(define author+date-style (new author+date-style%)) + +(define author+date-square-bracket-style (new - (class object% - (define/public (bibliography-table-style) bib-single-style) - (define/public (entry-style) bibentry-style) - (define/public (disambiguate-date?) #t) - (define/public (collapse-for-date?) #t) - (define/public (get-cite-open) "(") - (define/public (get-cite-close) ")") - (define/public (get-group-sep) "; ") - (define/public (get-item-sep) ", ") - (define/public (render-citation date-cite i) date-cite) - (define/public (render-author+dates author dates) (list* author " " dates)) - (define/public (bibliography-line i e) (list e)) + (class author+date-style% + (define/override (get-cite-open) "[") + (define/override (get-cite-close) "]") (super-new)))) (define number-style @@ -522,11 +532,17 @@ s)]) s)) +(define (string-capitalize str) + (if (non-empty-string? str) + (let ([chars (string->list str)]) + (list->string (cons (char-upcase (car chars)) (cdr chars)))) + str)) + (define (book-location #:edition [edition #f] #:publisher [publisher #f]) (let* ([s (if edition - @elem{@(string-titlecase (to-string edition)) edition} + @elem{@(string-capitalize (to-string edition)) edition} #f)] [s (if publisher (if s diff --git a/scribble-lib/scriblib/autobib.tex b/scribble-lib/scriblib/autobib.tex index ac67197d..3aa7d31c 100644 --- a/scribble-lib/scriblib/autobib.tex +++ b/scribble-lib/scriblib/autobib.tex @@ -6,3 +6,7 @@ \newlength{\ABcollength} \newcommand{\Autocolbibnumber}[1]{\parbox[t]{5ex}{\hfill#1~~\vspace{1.0ex}}} \newcommand{\Autocolbibentry}[1]{\setlength{\ABcollength}{\linewidth-5ex}\parbox[t]{\ABcollength}{#1\vspace{1.0ex}}} + +\newcommand{\Autobibref}[1]{#1} + +\providecommand{\AutobibLink}[1]{#1} diff --git a/scribble-lib/scriblib/bibtex.rkt b/scribble-lib/scriblib/bibtex.rkt index 4aae40f4..2b623930 100644 --- a/scribble-lib/scriblib/bibtex.rkt +++ b/scribble-lib/scriblib/bibtex.rkt @@ -471,6 +471,13 @@ #:date (raw-attr "year") #:location (raw-attr "school") #:url (raw-attr "url"))] + ["phdthesis" + (make-bib #:title (raw-attr "title") + #:author (parse-author (raw-attr "author")) + #:date (raw-attr "year") + #:location (dissertation-location #:institution (raw-attr "school") + #:degree "PhD") + #:url (raw-attr "url"))] ["techreport" (make-bib #:title (raw-attr "title") #:author (parse-author (raw-attr "author")) diff --git a/scribble-lib/scriblib/figure.rkt b/scribble-lib/scriblib/figure.rkt index 16780d49..c220abbb 100644 --- a/scribble-lib/scriblib/figure.rkt +++ b/scribble-lib/scriblib/figure.rkt @@ -1,6 +1,6 @@ #lang scheme/base - -(require scribble/manual +(require racket/contract/base + scribble/manual scribble/core scribble/decode scribble/html-properties @@ -12,9 +12,18 @@ figure* figure** figure-here - Figure-target - Figure-ref - figure-ref + (contract-out + [Figure-target (->* (string?) + (#:continue? any/c) + element?)] + [Figure-ref (->* (string?) + (#:link-render-style link-render-style?) + #:rest (listof string?) + element?)] + [figure-ref (->* (string?) + (#:link-render-style link-render-style?) + #:rest (listof string?) + element?)]) left-figure-style center-figure-style right-figure-style @@ -66,30 +75,40 @@ 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-style [label-style #f] #:continue? [continue? #f] . content) - (figure-helper figure-style style tag caption content continue?)) + (figure-helper figure-style style label-sep label-style tag caption content continue?)) (define (figure-here tag caption - #:style [style center-figure-style] + #:style [style center-figure-style] + #:label-sep [label-sep default-label-sep] + #:label-style [label-style #f] #:continue? [continue? #f] . content) - (figure-helper herefigure-style style tag caption content continue?)) + (figure-helper herefigure-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-style [label-style #f] #:continue? [continue? #f] . content) - (figure-helper figuremulti-style style tag caption content continue?)) + (figure-helper figuremulti-style style label-sep label-style tag caption content continue?)) (define (figure** tag caption - #:style [style center-figure-style] + #:style [style center-figure-style] + #:label-sep [label-sep default-label-sep] + #:label-style [label-style #f] #:continue? [continue? #f] . content) - (figure-helper figuremultiwide-style style tag caption content continue?)) + (figure-helper figuremultiwide-style style label-sep label-style tag caption content continue?)) -(define (figure-helper figure-style content-style tag caption content continue?) +(define (figure-helper figure-style content-style label-sep label-style tag caption content continue?) (make-nested-flow figure-style (list @@ -101,37 +120,57 @@ (list (make-element (if continue? legend-continued-style legend-style) - (list (Figure-target tag #:continue? continue?) caption))))))) + (list (Figure-target tag + #:label-sep label-sep + #:label-style label-style + #:continue? continue?) + caption))))))) (define figures (new-counter "figure" #:target-wrap make-figure-target #:ref-wrap make-figure-ref)) -(define (Figure-target tag #:continue? [continue? #f]) +(define (Figure-target tag + #:continue? [continue? #f] + #:label-sep [label-sep ": "] + #:label-style [label-style #f]) (counter-target figures tag "Figure" - (if continue? " (continued): " ": ") + #:label-suffix (list (if continue? " (continued)" "") label-sep) + #:label-style label-style #:target-style figure-target-style #:continue? continue?)) (define (ref-proc initial) - (case-lambda - [(tag) - (make-element #f (list (counter-ref figures tag (string-append initial "igure"))))] - [(tag1 tag2) - (make-element #f (list (counter-ref figures tag1 (string-append initial "igures")) - " and " - (counter-ref figures tag2 #f)))] - [(tag . tags) - (make-element #f (cons (counter-ref figures tag (string-append initial "igures")) - (let loop ([tags tags]) - (cond - [(null? (cdr tags)) - (list ", and " - (counter-ref figures (car tags) #f))] - [else - (list* ", " - (counter-ref figures (car tags) #f) - (loop (cdr tags)))]))))])) + (lambda (tag #:link-render-style [link-style #f] + . tags) + (cond + [(null? tags) + (make-element + #f + (counter-ref figures tag (string-append initial "igure") + #:link-render-style link-style))] + [(null? (cdr tags)) + (define tag1 (car tags)) + (define tag2 (cadr tags)) + (make-element #f (list (counter-ref figures tag1 (string-append initial "igures") + #:link-render-style link-style) + " and " + (counter-ref figures tag2 #f + #:link-render-style link-style)))] + [else + (make-element #f (cons (counter-ref figures tag (string-append initial "igures") + #:link-render-style link-style) + (let loop ([tags tags]) + (cond + [(null? (cdr tags)) + (list ", and " + (counter-ref figures (car tags) #f + #:link-render-style link-style))] + [else + (list* ", " + (counter-ref figures (car tags) #f + #:link-render-style link-style) + (loop (cdr tags)))]))))]))) (define Figure-ref (ref-proc "F")) (define figure-ref (ref-proc "f")) diff --git a/scribble-lib/scriblib/figure.tex b/scribble-lib/scriblib/figure.tex index 22d7bdc4..a2e90469 100644 --- a/scribble-lib/scriblib/figure.tex +++ b/scribble-lib/scriblib/figure.tex @@ -15,7 +15,7 @@ \newcommand{\LegendContinued}[1]{\Legend{#1}} \newcommand{\FigureTarget}[2]{#1} -\newcommand{\FigureRef}[2]{\hyperref[#2]{#1}} +\newcommand{\FigureRef}[2]{#1} \newlength{\FigOrigskip} \FigOrigskip=\parskip diff --git a/scribble-lib/scriblib/private/counter.rkt b/scribble-lib/scriblib/private/counter.rkt index ff85a685..35dc1b52 100644 --- a/scribble-lib/scriblib/private/counter.rkt +++ b/scribble-lib/scriblib/private/counter.rkt @@ -21,6 +21,8 @@ (define (counter-target counter tag label #:target-style [target-style #f] + #:label-style [label-style #f] + #:label-suffix [label-suffix '()] #:continue? [continue? #f] . content) (let ([content (decode-content content)]) @@ -34,10 +36,13 @@ (make-delayed-element (lambda (renderer part ri) (let ([n (resolve-get part ri (tag->counter-tag counter tag "value"))]) - (let ([l (cons (format "~a" n) content)]) - (if label - (list* label 'nbsp l) - l)))) + (cons + (make-element label-style + (let ([l (cons (format "~a" n) (decode-content (list label-suffix)))]) + (if label + (list* label 'nbsp l) + l))) + content))) (lambda () (if label (list* label 'nbsp "N" content) (cons "N" content))) @@ -54,9 +59,13 @@ (if (counter-target-wrap counter) ((counter-target-wrap counter) c + ;; Don't use this argument: (format "t:~a" (t-encode (tag->counter-tag counter tag)))) c))) +;; The use of this function is a leftover for backward compatibility. +;; Duplicating the linking functionality of `link-element`, etc., is +;; a bad idea. (define (t-encode s) (apply string-append @@ -69,31 +78,42 @@ [else (format "x~x" (char->integer c))])) (string->list (format "~s" s))))) -(define (counter-ref counter tag label) - (let ([n (make-delayed-element - (lambda (renderer part ri) - (let ([n (resolve-get part ri (tag->counter-tag counter tag "value"))]) - (if (counter-ref-wrap counter) - (let ([id (format "t:~a" (t-encode (list 'counter (list (counter-name counter) tag))))]) - ((counter-ref-wrap counter) - (format "~a" n) - id)) - (list (format "~a" n))))) - (lambda () (if label - (list label 'nbsp "N") - (list "N"))) - (lambda () (if label - (list label 'nbsp "N") - (list "N"))))]) - (make-link-element - #f - (if label - (list - label - 'nbsp - n) - n) - (tag->counter-tag counter tag)))) +(define (counter-ref counter tag label + #:link-render-style [link-style #f]) + (make-delayed-element + (lambda (renderer part ri) + (let ([n (resolve-get part ri (tag->counter-tag counter tag "value"))]) + (let ([n (if (counter-ref-wrap counter) + ((counter-ref-wrap counter) + (format "~a" n) + ;; Don't use this argument: + (format "t:~a" (t-encode (list 'counter (list (counter-name counter) tag))))) + (list (format "~a" n)))] + [link-number-only? (eq? (link-render-style-mode + (or link-style + (current-link-render-style))) + 'number)]) + (cond + [(and label link-number-only?) + (make-element #f + (list label 'nbsp + (make-link-element + #f + (list n) + (tag->counter-tag counter tag))))] + [else + (make-link-element + #f + (if label + (list label 'nbsp n) + n) + (tag->counter-tag counter tag))])))) + (lambda () (if label + (list label 'nbsp "N") + (list "N"))) + (lambda () (if label + (list label 'nbsp "N") + (list "N"))))) (define (counter-collect-value counter) (counter-n counter)) diff --git a/scribble-test/tests/scribble/docs/convertible.scrbl b/scribble-test/tests/scribble/docs/convertible.scrbl new file mode 100644 index 00000000..b99de3a9 --- /dev/null +++ b/scribble-test/tests/scribble/docs/convertible.scrbl @@ -0,0 +1,21 @@ +#lang scribble/base +@(require file/convertible) + +@(struct s () + #:property + prop:convertible + ;; Not actually convertible to anything: + (lambda (v req default) + default)) + +@(struct c () + #:property + prop:convertible + (lambda (v req default) + (cond + [(eq? req 'text) "hello"] + [else default]))) + +@(s) + +@(c) diff --git a/scribble-test/tests/scribble/docs/convertible.txt b/scribble-test/tests/scribble/docs/convertible.txt new file mode 100644 index 00000000..f27bd34d --- /dev/null +++ b/scribble-test/tests/scribble/docs/convertible.txt @@ -0,0 +1,3 @@ +# + +hello diff --git a/scribble-test/tests/scribble/docs/grouper2.scrbl b/scribble-test/tests/scribble/docs/grouper2.scrbl new file mode 100644 index 00000000..4fc76336 --- /dev/null +++ b/scribble-test/tests/scribble/docs/grouper2.scrbl @@ -0,0 +1,29 @@ +#lang scribble/base + +@title{Example} + +@table-of-contents[] + +@; ---------------------------------------- + +@section[#:style 'grouper]{Arbitrarily Small Data} + +@subsection[#:tag "A"]{A} + +See @secref["A"] and @secref["B"]. + +@; ---------------------------------------- + +@section[#:style '(unnumbered)]{Intermezzo} + +@subsection[#:style '(unnumbered)]{More} + +Nothing here. + +@; ---------------------------------------- + +@section[#:style 'grouper]{Arbitrarily Large Data} + +@subsection[#:tag "B"]{B} + +See @secref["A"] and @secref["B"]. diff --git a/scribble-test/tests/scribble/docs/grouper2.txt b/scribble-test/tests/scribble/docs/grouper2.txt new file mode 100644 index 00000000..56fa0df4 --- /dev/null +++ b/scribble-test/tests/scribble/docs/grouper2.txt @@ -0,0 +1,28 @@ +Example + +    I Arbitrarily Small Data +      1 A + +    Intermezzo +      More + +    II Arbitrarily Large Data +      2 B + +I. Arbitrarily Small Data + +1. A + +See A and B. + +Intermezzo + +More + +Nothing here. + +II. Arbitrarily Large Data + +2. B + +See A and B. diff --git a/scribble-test/tests/scribble/example.rkt b/scribble-test/tests/scribble/example.rkt index 1e7ec167..be26d0ea 100644 --- a/scribble-test/tests/scribble/example.rkt +++ b/scribble-test/tests/scribble/example.rkt @@ -32,10 +32,27 @@ (check-exn blames-this-module? (λ () (make-eval-factory '() #:lang '(+ 2 2)))) + (check-exn blames-this-module? + (λ () (scribble-exn->string #f))) + (check-exn blames-this-module? + (λ () (scribble-exn->string (λ (a b c) a)))) + (check-not-exn + (λ () (scribble-exn->string))) + (check-not-exn + (λ () + (parameterize ((scribble-exn->string (λ (a) "hello"))) + ((scribble-exn->string) "error")))) + (check-exn blames-this-module? (λ () (scribble-eval-handler #f))) (check-exn blames-this-module? (λ () (scribble-eval-handler (λ (ev t) t)))) + (check-not-exn + (λ () (scribble-eval-handler))) + (check-not-exn + (λ () + (parameterize ((scribble-eval-handler (λ (a b c) c))) + ((scribble-eval-handler) (λ (x) x) #f #true)))) (check-exn blames-this-module? (λ () (make-log-based-eval #f 'record))) diff --git a/scribble-test/tests/scriblib/autobib.rkt b/scribble-test/tests/scriblib/autobib.rkt index 2db86253..b5512052 100644 --- a/scribble-test/tests/scriblib/autobib.rkt +++ b/scribble-test/tests/scriblib/autobib.rkt @@ -1,6 +1,6 @@ #lang racket/base -(require rackunit scriblib/autobib) +(require rackunit scriblib/autobib scribble/base scribble/core) (test-case "define-cite" ;; Check that `define-cite` binds the expected identifiers @@ -39,6 +39,23 @@ (check-exn exn:fail? (λ () (book-location)))) +(define (mk-bookloc-elem/ed ed) (element (style #f '()) (list ed " edition"))) + +(test-case "book-location-edition-capitalization" + (check-equal? (book-location #:edition 'a) + (mk-bookloc-elem/ed "A")) + (check-equal? (book-location #:edition "first") + (mk-bookloc-elem/ed "First")) + (check-equal? (book-location #:edition 'Third) + (mk-bookloc-elem/ed "Third")) + (check-equal? (book-location #:edition 1) + (mk-bookloc-elem/ed "1")) + (check-equal? (book-location #:edition "1st") + (mk-bookloc-elem/ed "1st")) + (check-equal? (book-location #:edition "4th") + (mk-bookloc-elem/ed "4th"))) + + (test-case "techrpt-location" (check-not-exn (λ () (techrpt-location #:institution "MIT" #:number 'AIM-353)))