diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index 2f1bf1556f..568c43b5e1 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -1120,12 +1120,21 @@ (blockquote-paragraphs t))))) (define/override (render-itemization t part ri) - `((ul ,(if (and (styled-itemization? t) - (string? (styled-itemization-style t))) - `([class ,(styled-itemization-style t)]) - `()) - ,@(map (lambda (flow) `(li ,@(render-flow flow part ri #t))) - (itemization-flows t))))) + (let ([style-str (and (styled-itemization? t) + (string? (styled-itemization-style t)) + (styled-itemization-style t))]) + `((,(if (and (styled-itemization? t) + (eq? (styled-itemization-style t) 'ordered)) + 'ol + 'ul) + ,(if style-str + `([class ,style-str]) + `()) + ,@(map (lambda (flow) `(li ,(if style-str + `([class ,(string-append style-str "Item")]) + `()) + ,@(render-flow flow part ri #t))) + (itemization-flows t)))))) (define/override (render-other i part ri) (cond diff --git a/collects/scribble/latex-render.ss b/collects/scribble/latex-render.ss index 19ff53071b..678e3dc07b 100644 --- a/collects/scribble/latex-render.ss +++ b/collects/scribble/latex-render.ss @@ -365,12 +365,24 @@ null)) (define/override (render-itemization t part ri) - (printf "\n\n\\begin{itemize}\n") - (for ([flow (itemization-flows t)]) - (printf "\n\n\\item ") - (render-flow flow part ri #t)) - (printf "\n\n\\end{itemize}\n") - null) + (let* ([style-str (and (styled-itemization? t) + (string? (styled-itemization-style t)) + (styled-itemization-style t))] + [mode (or style-str + (if (and (styled-itemization? t) + (eq? (styled-itemization-style t) 'ordered)) + "enumerate" + "itemize"))]) + (printf "\n\n\\begin{~a}\n" mode) + (for ([flow (itemization-flows t)]) + (printf "\n\n\\~a" (if style-str + (format "~aItem{" style-str) + "item ")) + (render-flow flow part ri #t) + (when style-str + (printf "}"))) + (printf "\n\n\\end{~a}\n" mode) + null)) (define/override (render-blockquote t part ri) (let ([kind (or (blockquote-style t) "quote")]) diff --git a/collects/scribblings/scribble/config.scrbl b/collects/scribblings/scribble/config.scrbl index 2f145316d5..23fbb7a489 100644 --- a/collects/scribblings/scribble/config.scrbl +++ b/collects/scribblings/scribble/config.scrbl @@ -40,9 +40,14 @@ extend or configure Scribble fall into two groups: #:style `((css "inbox.css") (tex "inbox.tex"))]{Adding a Style} When a string is uses as a style in an @scheme[element], -@scheme[styled-paragraph], or @scheme[blockquote], it corresponds to a -CSS class for HTML output or a Tex macro (or Latex environment, in the -case of @scheme[blockquote]) for Latex output. +@scheme[styled-paragraph], @scheme[styled-itemization], or +@scheme[blockquote], it corresponds to a CSS class for HTML output or +a Tex macro/environment for Latex output. In Latex output, the string +is used as a macro name for a @scheme[styled-paragraph] and an +environment name for a @scheme[itemization] or @scheme[blockquote]. In +addition, for an itemization, the style string is suffixed with +@scheme["Item"] and used as a CSS class or Tex macro name to use for +the itemization's items (in place of @tt{item} in the case of Latex). Scribble includes a number of predefined styles that are used by the exports of @scheme[scribble/manual], but they are not generally diff --git a/collects/scribblings/scribble/struct.scrbl b/collects/scribblings/scribble/struct.scrbl index f0912ac1d6..5920fce24b 100644 --- a/collects/scribblings/scribble/struct.scrbl +++ b/collects/scribblings/scribble/struct.scrbl @@ -443,6 +443,23 @@ A @techlink{itemization} has a list of flows. } + +@defstruct[(styled-itemization itemization) ([style any/c])]{ + +The @scheme[style] can be + +@itemize[ + + @item{A string that corresponds to a CSS class for HTML output or a + macro for Latex output (see @secref["extra-style"]).} + + @item{The symbol @scheme['ordered], which generates @tt{