add `margin-note*' for putting a single-para note in the middle of a para

This commit is contained in:
Matthew Flatt 2010-05-21 19:18:57 -06:00
parent 141a37e50d
commit 18b06a9297
4 changed files with 25 additions and 3 deletions

View File

@ -495,6 +495,7 @@
element?)] element?)]
[url (-> string? element?)] [url (-> string? element?)]
[margin-note (->* () () #:rest (listof pre-flow?) block?)] [margin-note (->* () () #:rest (listof pre-flow?) block?)]
[margin-note* (->* () () #:rest (listof pre-content?) element?)]
[centered (->* () () #:rest (listof pre-flow?) block?)] [centered (->* () () #:rest (listof pre-flow?) block?)]
[verbatim (->* (string?) (#:indent exact-nonnegative-integer?) #:rest (listof string?) block?)]) [verbatim (->* (string?) (#:indent exact-nonnegative-integer?) #:rest (listof string?) block?)])
@ -528,6 +529,15 @@
(make-style "refcontent" null) (make-style "refcontent" null)
(decode-flow c))))))) (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 (verbatim #:indent [i 0] s . more)
(define indent (define indent
(if (zero? i) (if (zero? i)

View File

@ -152,16 +152,19 @@ table td {
/* ---------------------------------------- */ /* ---------------------------------------- */
/* Margin notes */ /* Margin notes */
.refpara { .refpara, .refelem {
position: relative; position: relative;
float: right; float: right;
left: 2em; left: 2em;
top: -1em;
height: 0em; height: 0em;
width: 13em; width: 13em;
margin: 0em -13em 0em 0em; margin: 0em -13em 0em 0em;
} }
.refpara {
top: -1em;
}
.refcolumn { .refcolumn {
background-color: #F5F5DC; background-color: #F5F5DC;
display: block; display: block;

View File

@ -101,6 +101,7 @@
% refcolumn and refcontent environments also wrap the note, % refcolumn and refcontent environments also wrap the note,
% because they simplify the CSS side. % because they simplify the CSS side.
\newcommand{\refpara}[1]{\marginpar{\raggedright \footnotesize #1}} \newcommand{\refpara}[1]{\marginpar{\raggedright \footnotesize #1}}
\newcommand{\refelem}[1]{\refpara{#1}}
\newenvironment{refcolumn}{}{} \newenvironment{refcolumn}{}{}
\newenvironment{refcontent}{}{} \newenvironment{refcontent}{}{}

View File

@ -168,12 +168,20 @@ address-harvesting robots.}
Produces a @tech{nested flow} whose content is centered.} 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 Produces a @tech{nested flow} that is typeset in the margin, instead
of inlined.} 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?] ... @defproc[(itemlist [itm item?] ...
[#:style style (or/c style? string? symbol? #f) #f]) [#:style style (or/c style? string? symbol? #f) #f])
itemization?]{ itemization?]{