commit 686e10f25e7cb18b341f0583b77bbaa7f97c2e42
parent 16d18c291d405ff4af1fc8d3e1367ba318668d6d
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Fri, 21 May 2010 19:18:57 -0600
add `margin-note*' for putting a single-para note in the middle of a para
original commit: 18b06a9297b82d549fa7c0d45a7bdeeef6abd922
Diffstat:
4 files changed, 25 insertions(+), 3 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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?]{