Fix the arXiv-template PDF output

The user-supplied template PDF exposed four concrete problems:

- title/headings were letter-spaced: plain text in a large paragraph took the
  SizedText segment path and was scaled twice; the fallback run now stays at
  the base size and is scaled once by the paragraph;
- the table lost its third column because unsupported math glyphs were sent
  through the PDF fallback font; table-cell math now has a readable ASCII
  fallback (Size (um), approx. 100, 10**6);
- fancyhdr's \cfoot{\thepage} was painted together with route-D's default page
  number; default numbering is skipped for a fancy pagestyle;
- .bib data was ignored; simple @article/@inproceedings entries are now parsed
  from project .bib files, inlined as thebibliography entries, and resolved by
  the existing citation pass, producing References and [1]-[3].

The regenerated 3-page PDF was checked for title/heading spacing, table text,
references and a single page number per page. A project regression test covers
the .bib path, and the table/heading fixes have unit tests.

Remaining visible limits in this template: the complex display equation, the
\fbox/rule figure body, vector/PDF images and the author block layout.
Test count moves to 1069 (444 core, 432 engine, 65 server).
This commit is contained in:
gloamxun committed 2026-10-27 13:38:36 +08:00
1 parent fab26234fc
commit b1e3e03f00
9 files changed
+457 -26

No files matched your search

+46
View File
@@ -1212,6 +1212,52 @@ fn serves_project_api_preview_and_pdf() {
);
}
#[test]
fn project_preview_resolves_bibtex() {
let server = TestServer::start("route-d-bib");
let source = "\\documentclass{article}\n\\begin{document}\nSee \\cite{alpha}.\n\n\\bibliography{refs}\n\\end{document}\n";
let put = server.request(
"PUT",
"/api/projects/hello/file?path=hello.tex",
source.as_bytes(),
"text/plain; charset=utf-8",
);
assert_eq!(put.status, 200, "{}", put.text());
let bib = "@article{alpha,\n title={Alpha entry},\n author={Doe, Jane},\n year={2024}\n}\n";
let put = server.request(
"PUT",
"/api/projects/hello/file?path=refs.bib",
bib.as_bytes(),
"text/plain; charset=utf-8",
);
assert_eq!(put.status, 200, "{}", put.text());
let preview = server.request(
"POST",
"/api/projects/hello/preview?engine=route-d",
&[],
"application/json",
);
assert_eq!(preview.status, 200, "{}", preview.text());
let value: Value = serde_json::from_slice(&preview.body).expect("preview JSON");
assert_eq!(value["status"], "ok", "{}", value["message"]);
let mut text = String::new();
for page in value["pages"].as_array().expect("pages") {
if let Some(svg) = page["svg"].as_str() {
for piece in svg.split('>') {
if let Some(content) = piece.split('<').next() {
text.push_str(content);
}
}
}
}
let text: String = text.split_whitespace().collect();
assert!(text.contains("References"), "{text}");
assert!(text.contains("[1]"), "{text}");
assert!(text.contains("Alphaentry"), "{text}");
assert!(!text.contains("[?]"), "{text}");
}
#[test]
fn project_preview_can_switch_to_route_d() {
let server = TestServer::start("route-d-toggle");