Skip to main content

Module multidoc

Module multidoc 

Source
Expand description

In-memory join of multiple core-XML documents into one.

An arXiv submission may ship several top-level .tex files — a main paper plus Supplementary-Material documents (see crate::main_tex::find_top_level_texs). Each is converted independently (its own \documentclass, its own core XML), then this module stitches them into a single core-XML document that the normal post-processing pipeline renders as one output: the main first, each supplement appended as a top-level appendix <section> titled by the supplement’s own \title.

This is the non-streaming join — it holds the parsed supplements in memory — which suits the overwhelmingly common case where a main+supplement pair is small. Very large submissions that need streaming are a separate concern (a post-pass “join” over separate core-XML files, tracked separately); this path deliberately keeps the whole pipeline downstream of a single <document> unchanged.

Id de-confliction. Both documents number from S1, share the label namespace (LABEL:sec:intro), etc. Every supplement’s id/ref/label space is rewritten with a per-source prefix (as1_, as2_, …) before splicing, so intra-supplement \refs still resolve and never collide with the main. A supplement that cross-\refs into the main will not resolve — faithful to arXiv, whose separately-compiled PDFs cannot cross-reference either.

Functions§

join_core_documents
Join a main core-XML string with zero or more supplements, returning the combined core XML. With no supplements the main is returned verbatim.