pub fn require_package_borrowed(name: &str) -> Result<()>Expand description
Load the binding of package name for another binding to build on, without the package counting as loaded — a
binding’s way of borrowing a package the real one does not load (theorem.sty’s and ntheorem.sty’s bindings
borrow amsthm’s theorem machinery; neither real package loads amsthm). Unless the document had loaded name
already, it is then marked unloaded (crate::state::mark_unloaded), and so is every file first loaded during the
borrow (amsthm’s amsgen, crate::state::end_borrow): \@ifpackageloaded{name} is false, as in LaTeX, and the
document’s own later \usepackage{name} loads the binding again, whose definitions then take over (amsthm.sty:77’s
\newtheorem, amsthm_sty.rs \lx@amsthm@newtheorem); "{name}.sty:borrowed" tells that load it follows a
borrow. What the borrow defines carries DefinitionOrigin::Borrowed: in LaTeX those names do not exist, so they
yield to any later definition — the document’s, or any raw file’s, TeX Live’s or the author’s (\newcommand,
\newenvironment, \providecommand; latex_constructs is_definable_latex) — and the binding sets no lock while
"{name}.sty:borrowing" is set (amsthm’s proof lock), except that natbib’s locks (\citet, \citep, its
\bibitem internals) stay, and the ijcai binding lifts those on \citet/\citep (unless natbib was loaded
first), over its own IJCAI \cite and \shortcite (2107.13646). The names the borrowing package’s real file
defines too the binding claims as its own (crate::state::claim_borrowed_meanings: ntheorem’s [amsthm] proof,
theorem.sty’s skips), and they do not yield. Not covered: a conditional (\@ifundefined{proof}) still
sees a borrowed name defined, and a local assignment of a borrowed name clears its mark for good
(fallback_meanings). Witnesses 2211.14033, 2512.06733 (ifacconf), 1507.02955 (cc.cls’s ccproof.sty:56). Guards
perfect_kernel_batch67p::{theorem_then_amsthm_takes_over, amsthm_before_theorem_stays_loaded},
perfect_kernel_batch67ps::*.