diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index 1f1a0c77..060a7f22 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -789,15 +789,13 @@ [style (if (with-attributes? raw-style) (with-attributes-style raw-style) raw-style)]) - (if (and (pair? style) (eq? (car style) 'div-hack)) - `((div ,(cdr style) ,@contents)) - `((,(if (string? style) 'div 'p) - ,(append - (if (string? style) - `([class ,style]) - `()) - (style->attribs raw-style)) - ,@contents))))) + `((,(if (eq? style 'div) 'div 'p) + ,(append + (if (string? style) + `([class ,style]) + `()) + (style->attribs raw-style)) + ,@contents)))) (define/override (render-element e part ri) (cond diff --git a/collects/scribble/latex-render.ss b/collects/scribble/latex-render.ss index 26542cbf..bbc5d2fe 100644 --- a/collects/scribble/latex-render.ss +++ b/collects/scribble/latex-render.ss @@ -79,14 +79,24 @@ (define/override (render-paragraph p part ri) (printf "\n\n") - (let ([margin? (and (styled-paragraph? p) - (equal? "refpara" (styled-paragraph-style p)))]) - (when margin? - (printf "\\marginpar{\\footnotesize ")) + (let ([style (and (styled-paragraph? p) + (let ([s (flatten-style + (styled-paragraph-style p))]) + (if (with-attributes? s) + (let ([base (with-attributes-style s)]) + (if (eq? base 'div) + (let ([a (assq 'class (with-attributes-assoc s))]) + (if a + (cdr a) + base)) + base)) + s)))]) + (when (string? style) + (printf "\\~a{" style)) (if (toc-paragraph? p) (printf "\\newpage \\tableofcontents \\newpage") (super render-paragraph p part ri)) - (when margin? (printf "}"))) + (when (string? style) (printf "}"))) (printf "\n\n") null) diff --git a/collects/scribble/scribble.tex b/collects/scribble/scribble.tex index 32120b82..b5a89457 100644 --- a/collects/scribble/scribble.tex +++ b/collects/scribble/scribble.tex @@ -68,6 +68,7 @@ \newcommand{\noborder}[1]{#1} \newcommand{\imageleft}[1]{} % drop it \newcommand{\smaller}[1]{{\footnotesize #1}} +\newcommand{\refpara}[1]{\marginpar{\footnotesize #1}} \newcommand{\titleAndVersion}[2]{\title{#1\\{\normalsize Version #2}}\maketitle} diff --git a/collects/scribblings/scribble/struct.scrbl b/collects/scribblings/scribble/struct.scrbl index ef77a8cd..7096bfda 100644 --- a/collects/scribblings/scribble/struct.scrbl +++ b/collects/scribblings/scribble/struct.scrbl @@ -330,12 +330,22 @@ A @techlink{paragraph} has a list of @tech{elements}. @defstruct[(styled-paragraph paragraph) ([style any/c])]{ -The @scheme[style] is normally a string that corresponds to a CSS -class for HTML output, in which case a @tt{
} block is generated -instead of a @tt{

} block. A base style can also be a -@scheme[with-attributes] instance to add arbitrary HTML attributes. +The @scheme[style] can be -} +@itemize[ + + @item{A string that corresponds to a CSS class for HTML output or a + macro for Latex output.} + + @item{An instance of @scheme[with-attributes], which combines a base + style with a set of additional HTML attributes.} + + @item{The symbol @scheme['div], which generates @tt{

} HTML + output instead of @tt{

}. For Latex output, a string for a + macro name is extracted from the @scheme['class] mapping of a + @scheme[with-attributes] wrapper, if one is present.} + +]} @defstruct[table ([style any/c] @@ -379,7 +389,7 @@ The @scheme[style] can be any of the following: ]} - @item{an instance of @scheme[with-attributes], which combines a base + @item{An instance of @scheme[with-attributes], which combines a base style with a set of additional HTML attributes.} ]}