diff --git a/collects/scribble/base.rkt b/collects/scribble/base.rkt index d3d7fc4431..75b61be446 100644 --- a/collects/scribble/base.rkt +++ b/collects/scribble/base.rkt @@ -495,6 +495,7 @@ element?)] [url (-> string? element?)] [margin-note (->* () () #:rest (listof pre-flow?) block?)] + [margin-note* (->* () () #:rest (listof pre-content?) element?)] [centered (->* () () #:rest (listof pre-flow?) block?)] [verbatim (->* (string?) (#:indent exact-nonnegative-integer?) #:rest (listof string?) block?)]) @@ -528,6 +529,15 @@ (make-style "refcontent" null) (decode-flow c))))))) +(define (margin-note* . c) + (make-element + (make-style "refelem" null) + (make-element + (make-style "refcolumn" null) + (make-element + (make-style "refcontent" null) + (decode-content c))))) + (define (verbatim #:indent [i 0] s . more) (define indent (if (zero? i) diff --git a/collects/scribble/scribble.css b/collects/scribble/scribble.css index aa5c272ff9..8f1e2b4c9c 100644 --- a/collects/scribble/scribble.css +++ b/collects/scribble/scribble.css @@ -152,16 +152,19 @@ table td { /* ---------------------------------------- */ /* Margin notes */ -.refpara { +.refpara, .refelem { position: relative; float: right; left: 2em; - top: -1em; height: 0em; width: 13em; margin: 0em -13em 0em 0em; } +.refpara { + top: -1em; +} + .refcolumn { background-color: #F5F5DC; display: block; diff --git a/collects/scribble/scribble.tex b/collects/scribble/scribble.tex index 0fc36b6ea6..8eca64f1c8 100644 --- a/collects/scribble/scribble.tex +++ b/collects/scribble/scribble.tex @@ -101,6 +101,7 @@ % refcolumn and refcontent environments also wrap the note, % because they simplify the CSS side. \newcommand{\refpara}[1]{\marginpar{\raggedright \footnotesize #1}} +\newcommand{\refelem}[1]{\refpara{#1}} \newenvironment{refcolumn}{}{} \newenvironment{refcontent}{}{} diff --git a/collects/scribblings/scribble/base.scrbl b/collects/scribblings/scribble/base.scrbl index 1c803d33b8..1917789dcf 100644 --- a/collects/scribblings/scribble/base.scrbl +++ b/collects/scribblings/scribble/base.scrbl @@ -168,12 +168,20 @@ address-harvesting robots.} Produces a @tech{nested flow} whose content is centered.} -@defproc[(margin-note [pre-content pre-content?] ...) blockquote?]{ +@defproc[(margin-note [pre-flow pre-flow?] ...) block?]{ Produces a @tech{nested flow} that is typeset in the margin, instead of inlined.} +@defproc[(margin-note* [pre-content pre-content?] ...) element?]{ + +Produces an @tech{element} that is typeset in the margin, instead of +inlined. Unlike @racket[margin-note], @racket[margin-note*] can be +used in the middle of a paragraph; at the same time, its content is +constrained to form a single paragraph in the margin.} + + @defproc[(itemlist [itm item?] ... [#:style style (or/c style? string? symbol? #f) #f]) itemization?]{