Skip to content

Commit d9f04c1

Browse files
committed
scriblib/footnote: add style for numbers in footnotes and references
1 parent fc165b8 commit d9f04c1

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

scribble-doc/scriblib/scribblings/footnote.scrbl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,23 @@ redefined as CSS classes or Latex macros to adjust the result:
8181
note. For Latex, this name is mapped to a macro that returns nothing,
8282
leaving the reference managment to @tt{\footnote}.}
8383

84+
@item{@racket["FootnoteRefNumber"]: Wrapped around the footnote
85+
number as a reference (inside of @racket["FootnoteRef"]), so that the
86+
default superscript style for a footnote reference can be changed for
87+
HTML output (or potentially for Latex, if @racket["Footnote"] is not
88+
mapped to @tt{\footnote}).}
89+
8490
@item{@racket["FootnoteTarget"]: Wrapped around the footnote that is
8591
rendered by @racket[footnote-part-id] or as a margin note. For Latex,
8692
this name is mapped to a macro that returns nothing, leaving the
8793
reference managment to @tt{\footnote}.}
8894

95+
@item{@racket["FootnoteTargetNumber"]: Wrapped around the footnote
96+
number rendered by @racket[footnote-part-id] or as a margin note, so
97+
that the default superscript style within a footnote can be changed
98+
for HTML (or potentially for Latex, if @racket["Footnote"] is not
99+
mapped to @tt{\footnote}).}
100+
89101
@item{@racket["FootnoteContent"]: For Latex, wrapped around the
90102
content of a footnote as rendered by @racket[footnote-part-id].}
91103

scribble-lib/scriblib/footnote.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@
2626
padding-left: 1em;
2727
text-indent: -0.5em;
2828
}
29+
30+
.FootnoteRefNumber, .FootnoteTargetNumber {
31+
vertical-align: super;
32+
font-size: .83em;
33+
}

scribble-lib/scriblib/footnote.rkt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@
3333

3434
(define footnote-style (make-style "Footnote" footnote-style-extras))
3535
(define footnote-ref-style (make-style "FootnoteRef" footnote-style-extras))
36+
(define footnote-ref-number-style (make-style "FootnoteRefNumber" footnote-style-extras))
3637
(define footnote-content-style (make-style "FootnoteContent" footnote-style-extras))
3738
(define footnote-margin-content-style (make-style "FootnoteMarginContent" footnote-style-extras))
3839
(define footnote-target-style (make-style "FootnoteTarget" footnote-style-extras))
40+
(define footnote-target-number-style (make-style "FootnoteTargetNumber" footnote-style-extras))
3941
(define footnote-block-style (make-style "FootnoteBlock" footnote-style-extras))
4042
(define footnote-block-content-style (make-style "FootnoteBlockContent" footnote-style-extras))
4143

@@ -65,7 +67,7 @@
6567
(define tag (generated-tag))
6668
(define content (decode-content text))
6769
(define target (cons (make-element footnote-target-style
68-
(make-element 'superscript
70+
(make-element footnote-target-number-style
6971
(counter-target footnotes tag #f
7072
#:use-ref? #t)))
7173
content))
@@ -75,13 +77,14 @@
7577
(set id (cons target (get id null))))
7678
(make-element footnote-style
7779
(list (make-element footnote-ref-style
78-
(make-element 'superscript (counter-ref footnotes tag #f
79-
#:use-target? #t)))
80+
(make-element footnote-ref-number-style
81+
(counter-ref footnotes tag #f
82+
#:use-target? #t)))
8083
(if margin?
8184
(make-element footnote-margin-content-style target)
8285
(cond-element
8386
[latex
84-
(make-element footnote-content-style content)]
87+
(make-element footnote-content-style target)]
8588
[else
8689
null])))))))
8790

scribble-lib/scriblib/footnote.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
\newcommand{\Footnote}[1]{\footnote{#1}}
66
\newcommand{\FootnoteRef}[1]{}
7+
\newcommand{\FootnoteRefNumber}[1]{#1}
78
\newcommand{\FootnoteTarget}[1]{}
9+
\newcommand{\FootnoteTargetNumber}[1]{#1}
810
\newcommand{\FootnoteContent}[1]{#1}
911
\newcommand{\FootnoteMarginContent}[1]{#1}
1012

0 commit comments

Comments
 (0)