Add footnote insertion area and thanks

This commit is contained in:
gloamxun committed 2026-10-19 13:11:17 +08:00
1 parent 5fa301fdcd
commit 1da46c61d6
11 files changed
+486 -28

No files matched your search

+54
View File
@@ -461,3 +461,57 @@ This is a minipage with enough text to wrap across several lines and demonstrate
assert!(svg.contains(">vbox</text>"), "vbox content missing");
assert!(svg.contains(">bold</text>"), "vbox styled content missing");
}
#[test]
fn footnotes_are_placed_at_the_page_bottom() {
let source = r#"\documentclass{article}
\begin{document}
First paragraph.\footnote{This is a footnote.}
Second paragraph.\footnote{Another note.}
Third paragraph.
\end{document}
"#;
let value = fresh_preview(source, "footnotes.tex");
assert_eq!(value["status"], "ok", "{}", value["message"]);
let svg = page_svg(&value, 0);
assert!(svg.contains("¹"), "footnote marker missing");
assert!(svg.contains("²"), "second footnote marker missing");
let body = text_y(&svg, "First");
let note = text_y(&svg, "This");
assert!(
note > body + 150.0,
"footnote is not at the page bottom: {note}"
);
assert!(
text_x(&svg, "This") > 7.5 && text_x(&svg, "This") < 11.0,
"footnote indent missing"
);
assert!(
svg.contains("fill=\"#000000\"/>"),
"footnote separator rule missing"
);
}
#[test]
fn thanks_creates_a_title_footnote() {
let source = r#"\documentclass{article}
\title{A Title\thanks{Thanks to the test suite.}}
\author{Author\thanks{Author affiliation.}}
\begin{document}
\maketitle
Body text.
\end{document}
"#;
let value = fresh_preview(source, "thanks.tex");
assert_eq!(value["status"], "ok", "{}", value["message"]);
let svg = page_svg(&value, 0);
assert!(svg.contains("¹"), "title thanks marker missing");
assert!(svg.contains("²"), "author thanks marker missing");
let note = text_y(&svg, "Thanks");
assert!(
note > 200.0,
"title footnote is not at the page bottom: {note}"
);
}