Skip to main content

find_top_level_texs

Function find_top_level_texs 

Source
pub fn find_top_level_texs(dir: &Path) -> Result<Vec<PathBuf>, String>
Expand description

Ordered list of top-level .tex files: the main document first, then any Supplementary-Material documents that ship alongside it. find_main_tex returns element 0 of this list; embedders that want to convert the whole submission (main + supplements, appended in order — arXiv’s multi-top-level model, submit_legacy_differences) drive off the full list.

Detection is deliberately precision-first / template-safe. A supplement is admitted only when it is a \documentclass file that (a) ships its own matching .bbl — arXiv’s canonical ms.tex+ms.bbl / supplement.tex+ supplement.bbl fingerprint, which bundled class templates do not have — and (b) self-identifies as supplementary by \title or filename (supplement/supporting/supplemental/appendix/SI/SM). Both gates together keep a messy bundle’s template from ever being mistaken for a second document. An explicit 00README listing two or more top-level files overrides the heuristic (author intent), still ordered main-first.

Conservative residual: a supplement bundled without its own .bbl, or one that does not self-identify, is not auto-detected.