diff --git a/README.md b/README.md index 4d5e5bc..ede8915 100644 --- a/README.md +++ b/README.md @@ -386,7 +386,8 @@ Manual `thebibliography` entries also work. Documents loading `natbib` or `arxiv.sty` render `\citet`/`\citep` as author-year citations, format `.bib` entries in plainnat order (`First Last`, `In ...`, `pages`, publisher/year), add deterministic year suffixes (`2014a`, `2014b`) when several entries share -an author and year, and omit numeric bibliography labels; other documents keep +an author and year, indent continuation lines in the plainnat hanging style, +and omit numeric bibliography labels; other documents keep numeric citations. Custom `.bst` sorting/formatting and page-number references (`\pageref`) are not implemented. diff --git a/docs/STATUS.md b/docs/STATUS.md index d53afc5..d3bf614 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -70,8 +70,9 @@ the source changes; the SVG preview is refreshed per page. - Citations: numeric citations by default; `natbib`/`arxiv.sty` selects author-year `\citet`/`\citep` from `.bib` metadata, formats bibliography entries in plainnat order (`First Last`, `In ...`, `pages`, publisher/year), adds - deterministic `2014a`/`2014b` suffixes for duplicate author-year entries, and - drops numeric bibliography labels. + deterministic `2014a`/`2014b` suffixes for duplicate author-year entries, + indents continuation lines (plainnat hanging style), and drops numeric + bibliography labels. - Live preview: paragraph cache, page-hash diffing, warm rebuilds in the low milliseconds for small edits. diff --git a/src/rust_typeset/pdf/layout.rs b/src/rust_typeset/pdf/layout.rs index 87af505..0413466 100644 --- a/src/rust_typeset/pdf/layout.rs +++ b/src/rust_typeset/pdf/layout.rs @@ -2869,10 +2869,11 @@ pub(super) fn build_positioned_pages( numbered.extend(runs.clone()); numbered }; - for line in measure_positioned_lines( + let hanging_indent_mm = 7.0; + let entry_lines = measure_positioned_lines( &numbered, 10, - content_width_mm, + (content_width_mm - hanging_indent_mm).max(10.0), metrics, font_cache, cjk_family, @@ -2881,7 +2882,8 @@ pub(super) fn build_positioned_pages( math_metrics, math_layout, cache, - ) { + ); + for (entry_line_index, line) in entry_lines.into_iter().enumerate() { let anchor = PageAnchor { block: block_index, line: line_index, @@ -2907,7 +2909,11 @@ pub(super) fn build_positioned_pages( anchor, content: line.content, y: cursor, - x: 0, + x: if entry_line_index == 0 { + 0 + } else { + millimeters_to_scaled(hanging_indent_mm) + }, centered: false, ragged: false, })); diff --git a/tests/typeset.rs b/tests/typeset.rs index b12b2c8..90b50b0 100644 --- a/tests/typeset.rs +++ b/tests/typeset.rs @@ -98,6 +98,13 @@ fn arxiv_fixture_is_three_letter_pages() { assert!(first_page.contains("REPRINT"), "missing undertitle"); assert!(first_page.contains("Hippocampus"), "missing author column"); assert!(first_page.contains("October"), "missing date"); + let third_page = page_svg(&value, 2); + let entry_x = text_x(&third_page, "Geor"); + let continuation_x = text_x(&third_page, "Recognition"); + assert!( + continuation_x - entry_x > 3.0, + "bibliography continuation lines should be indented: {entry_x} vs {continuation_x}" + ); } #[test]