Skip to main content

latexml_core/binding/
author_files.rs

1//! The bindings that stand in for an author's file: a journal's, a conference's or a person's class or style that
2//! TeX Live has never distributed and LaTeXML does not provide, so a paper that uses it ships its copy (`arxiv.sty`,
3//! `neurips_2024.sty`, `JHEP.cls`, `svjour3.cls`, `aa.cls`, …). The binding is a stand-in for that copy, not the file:
4//! `\IfFileExists` and `\InputIfFileExists` find the file only when the paper ships it, as TeX does
5//! ([`crate::binding::content::binding_counts_as_file`]); witness 2606.27281 (`\IfFileExists{arxiv.sty}` without
6//! the file). The copy the paper ships is read after the binding, every definition of a name the binding owns holding
7//! only inside the copy's own code, so that its extra commands are defined ("a stand-in's copy provides",
8//! [`crate::binding::content`] `read_stand_in_copy`, OXIDIZED_DESIGN_DIVERGENCES #731; 1309.5950's aas_macros.sty
9//! `\kms`). Every other compiled binding is the file it is named for — TeX Live's (found where the host's tree
10//! lacks it: babel's `italian.ldf` on a trimmed tree), a file TeX Live once distributed ([`FORMER_TEX_LIVE`]: TeX in
11//! the paper's era found it, so 1710.04900's harvard.sty `\IfFileExists{html.sty}` loads the html binding), or
12//! LaTeXML's own ([`LATEXML_OWN`]; the pools, font maps and drivers such as `pgfsys-latexml.def` need no list).
13//!
14//! Every registered `.cls`/`.sty`/`.tex` binding TL 2025's kpathsea does not find is on exactly one of the three
15//! lists, by name and case (TeX on a case-sensitive file system finds neither `JHEP.cls` for TL 2007's `jhep.cls` nor
16//! `ieeeconf.cls` for `IEEEconf.cls`; TL 2025's `mn2e.cls` is a documentation file of mnras, which kpathsea does not
17//! search). TeX Live's history is read from its file lists: the TL 2007 image's
18//! `texmf/lists`, the TL 2008 tlpdb, the TL 2009 texmf listing and the tlpdb of every year 2010-2024. Guards:
19//! `perfect_kernel_batch68d::author_file_stand_ins_are_bindings_outside_tex_live` (each entry against the registry
20//! and kpathsea, the lists disjoint) and `::every_binding_outside_tex_live_is_listed` (the reverse, on a full tree).
21
22/// Bindings for files TeX Live distributed once and no longer does, with the years their file lists show them (TL
23/// 2007-2024 checked; "before 2007" for the ones the 2026-10-15 ruling names that no list from 2007 on has). Each
24/// answers `\IfFileExists` as a TeX Live file does.
25pub const FORMER_TEX_LIVE: &[(&str, &str)] = &[
26  ("aastex.cls", "2007-2014"),
27  ("aastex.sty", "2007-2014"),
28  ("aastex62.cls", "2018"),
29  ("aastex63.cls", "2019"),
30  ("aastex631.cls", "2020-2024"),
31  ("cropmark.sty", "2007-2019"),
32  ("elsart.cls", "2007-2009"),
33  ("elsart1p.cls", "2007-2009"),
34  ("elsart3p.cls", "2007-2009"),
35  ("elsart5p.cls", "2007-2009"),
36  ("html.sty", "before 2007"),
37  ("luximono.sty", "before 2007"),
38  ("phyzzx.plus", "2007-2009"),
39  ("phyzzx.tex", "2007-2009"),
40  ("psfig.sty", "2007"),
41  ("psfig.tex", "before 2007"),
42  ("rsfs.sty", "before 2007"),
43  ("scrpage.sty", "2007-2012"),
44  ("scrpage2.sty", "2007-2019"),
45  ("slashbox.sty", "2007-2009"),
46  ("undertilde.sty", "2007-2009"),
47];
48
49/// LaTeXML's own `.cls`/`.sty`/`.tex` bindings that TeX Live does not distribute: they are the files they are named
50/// for — LaTeXML's styles (`latexml.sty`, `lxRDFa.sty`, `ar5iv.sty`, `latexmlman.sty`, `xylatexml.tex`), its fallback
51/// class `OmniBus.cls`, the shared cores the class bindings load (`ams_core.cls`, the `_support` styles) and the test
52/// fixtures (`keysetopt.sty`, `lxtesttemplate.sty`).
53pub const LATEXML_OWN: &[&str] = &[
54  "OmniBus.cls",
55  "aa_support.sty",
56  "aas_support.sty",
57  "ams_core.cls",
58  "ams_support.sty",
59  "ar5iv.sty",
60  "babel_support.sty",
61  "elsart_support.sty",
62  "elsart_support_core.sty",
63  "icml_support.sty",
64  "ims_support.sty",
65  "inst_support.sty",
66  "iopart_support.sty",
67  "latexml.sty",
68  "latexmlman.sty",
69  "lxRDFa.sty",
70  "mn2e_support.sty",
71  "pstricks_support.sty",
72  "revtex3_support.sty",
73  "revtex4_support.sty",
74  "sv_support.sty",
75  "xylatexml.tex",
76  "keysetopt.sty",
77  "lxtesttemplate.sty",
78];
79
80/// The stand-ins ([module docs](self)), by the binding's file name.
81pub const AUTHOR_FILE_STAND_INS: &[&str] = &[
82  "CECS.cls",
83  "Definitions/mdpi.cls",
84  "IEEEAerospaceCLS.cls",
85  "IEEEapm.cls",
86  "IEEEoj.cls",
87  "IEEEojcsys.cls",
88  "IEEEtaes.cls",
89  "IEEEtai.cls",
90  "INTERSPEECH2021.sty",
91  "INTERSPEECH2022.sty",
92  "INTERSPEECH2023.sty",
93  "Interspeech.cls",
94  "JHEP.cls",
95  "JHEP2.cls",
96  "JHEP3.cls",
97  "JINST.cls",
98  "MRM.cls",
99  "NJDnatbib.sty",
100  "PRIMEarxiv.sty",
101  "PoS.cls",
102  "SCIS2024.cls",
103  "SNmult.cls",
104  "WileyASNA-v1.cls",
105  "WileyMSP-template.cls",
106  "WileyNJD-v1.cls",
107  "WileyNJD-v2.cls",
108  "WileyNJDv5.cls",
109  "aa.cls",
110  "aaai.sty",
111  "aamas.cls",
112  "aas2pp4.sty",
113  "aas_macros.sty",
114  "aasms.sty",
115  "aaspp.sty",
116  "aaspptwo.sty",
117  "aastex7.cls",
118  "aastex70.cls",
119  "acl.sty",
120  "aero.cls",
121  "agujournal2019.cls",
122  "agutexSI2019.cls",
123  "aipcheck.tex",
124  "aipproc.cls",
125  "aipproc.sty",
126  "aistats.sty",
127  "aistats2026.sty",
128  "aistats2e.sty",
129  "aistats2eM.sty",
130  "aj_pt4.sty",
131  "alggeom.cls",
132  "amsppt.cls",
133  "an.cls",
134  "apjfonts.sty",
135  "apjpt4.sty",
136  "appolb.cls",
137  "arxbj.cls",
138  "arximspdf.cls",
139  "arxiv.sty",
140  "arxstspdf.cls",
141  "asme2ej.cls",
142  "atlasdoc.cls",
143  "autart.cls",
144  "axodraw.sty",
145  "bmcart.cls",
146  "bmvc2k.cls",
147  "bmvc2k_natbib.sty",
148  "bytedance_seed.cls",
149  "ceurart.cls",
150  "cimart.cls",
151  "cimento.cls",
152  "citesort.sty",
153  "clear2025.cls",
154  "cmcal.sty",
155  "coling.sty",
156  "colm.sty",
157  "colm2025_conference.sty",
158  "colt2024.cls",
159  "colt2025.cls",
160  "colt2026.cls",
161  "compositio.cls",
162  "conll.sty",
163  "corl.sty",
164  "crckapb.sty",
165  "cvpr.sty",
166  "cvpr2023.sty",
167  "cvpr2024.sty",
168  "cvpr2025.sty",
169  "czipreprint.cls",
170  "czjphys.cls",
171  "daj.cls",
172  "deluxe.sty",
173  "deluxetable.sty",
174  "dgruyter.sty",
175  "diagrams.sty",
176  "diagrams.tex",
177  "dmtcs-episciences.cls",
178  "doublespace.sty",
179  "eacl.sty",
180  "ecai.cls",
181  "edpsmath.cls",
182  "egpubl.cls",
183  "elife.cls",
184  "elsart.sty",
185  "emlines.sty",
186  "emnlp-ijcnlp.sty",
187  "emnlp.sty",
188  "emulateapj.sty",
189  "emulateapj5.sty",
190  "entcs.cls",
191  "entics.cls",
192  "epl.cls",
193  "epl2.cls",
194  "eptcs.cls",
195  "equations.sty",
196  "espcrc.sty",
197  "fairmeta.cls",
198  "fcs.cls",
199  "floatfig.sty",
200  "fullname.sty",
201  "gen-j-l.cls",
202  "gen-m-l.cls",
203  "gen-p-l.cls",
204  "gretsi.cls",
205  "gtpart.cls",
206  "hha.cls",
207  "hld.cls",
208  "iccv.sty",
209  "iccvw.sty",
210  "iclr.sty",
211  "icml.sty",
212  "icml2016.sty",
213  "icml2017.sty",
214  "icml2018.sty",
215  "icml2019.sty",
216  "icml2020.sty",
217  "icml2021.sty",
218  "icml2022.sty",
219  "icml2023.sty",
220  "icml2024.sty",
221  "icml2025.sty",
222  "ieeeaccess.cls",
223  "ieeecolor.cls",
224  "ieeeconf.cls",
225  "ieeetj.cls",
226  "ijcai.sty",
227  "imsart.cls",
228  "imsart.sty",
229  "informs.cls",
230  "interact.cls",
231  "iopams.sty",
232  "iopart.cls",
233  "iucr.cls",
234  "jabbrv.sty",
235  "jair.sty",
236  "jcappub.sty",
237  "jcm.cls",
238  "jfm.cls",
239  "jgcc.cls",
240  "jheppub.sty",
241  "jhrs.cls",
242  "jinstpub.sty",
243  "jmlr2e.sty",
244  "jmlr2e_preprint.sty",
245  "jpc.sty",
246  "jpconf.cls",
247  "just.cls",
248  "l-aa-ps.cls",
249  "l-aa.cls",
250  "l4dc2026.cls",
251  "laa.cls",
252  "lanlmac.tex",
253  "lipics-v2019.cls",
254  "lipics-v2021.cls",
255  "lipics-v2024.cls",
256  "lipics.cls",
257  "lmcs.cls",
258  "mdpi.cls",
259  "midl.cls",
260  "mn.cls",
261  "mn2e.cls",
262  "moduli.cls",
263  "mprocl.sty",
264  "mssymb.tex",
265  "naacl.sty",
266  "naaclhlt.sty",
267  "nature-pre.cls",
268  "nature_mod.cls",
269  "neurips.sty",
270  "neurips_2019.sty",
271  "neurips_2020.sty",
272  "neurips_2021.sty",
273  "neurips_2022.sty",
274  "neurips_2023.sty",
275  "neurips_2024.sty",
276  "neurips_2025.sty",
277  "neurips_2026.sty",
278  "neus2025.cls",
279  "nic-series.cls",
280  "nips.sty",
281  "ol2.sty",
282  "openmoss.cls",
283  "opex3.sty",
284  "optica-article.cls",
285  "osajnl.sty",
286  "osajnl2.sty",
287  "pasa.cls",
288  "pasj00.cls",
289  "pasj01.cls",
290  "pasj02.cls",
291  "paspconf.sty",
292  "picins.sty",
293  "pnas-new.cls",
294  "pos.sty",
295  "proofwiki.sty",
296  "ptephy.cls",
297  "ptephy_v1.cls",
298  "ptephy_v2.cls",
299  "ragslab.sty",
300  "rasti.cls",
301  "revtex.cls",
302  "revtex.sty",
303  "revtex4.sty",
304  "rmaa.cls",
305  "sagej.cls",
306  "scicite.sty",
307  "selfevolagent.cls",
308  "setstack.sty",
309  "siamart.cls",
310  "siamltex.cls",
311  "siamonline.cls",
312  "siamproceedings.sty",
313  "sigma.cls",
314  "smc_ieeeconf.cls",
315  "sn-jnl.cls",
316  "spconf.sty",
317  "sprocl.sty",
318  "stwol.sty",
319  "svjour.cls",
320  "svjour1.cls",
321  "svjour2.cls",
322  "svjour3.cls",
323  "svmono.cls",
324  "svmult.cls",
325  "svproc.cls",
326  "tac.cls",
327  "tacl.sty",
328  "tcilatex.tex",
329  "theapa.sty",
330  "tlp.cls",
331  "tmlr.sty",
332  "turing.sty",
333  "uai2025.cls",
334  "usenix.sty",
335  "vgtc.cls",
336  "vmsta.cls",
337  "wacv.sty",
338  "webofc.cls",
339  "widetext.sty",
340  "wileyNJDv5.cls",
341  "wlpeerj.cls",
342  "ws-ijgmmp.cls",
343  "ws-ijmpa.cls",
344  "ws-ijmpb.cls",
345  "ws-ijmpc.cls",
346  "ws-ijmpd.cls",
347  "ws-ijmpe.cls",
348  "ws-mpla.cls",
349  "ws-mplb.cls",
350  "ws-p8-50x6-00.cls",
351  "ws-procs961x669.cls",
352  "ws-procs9x6.cls",
353  "ws-rv-har.sty",
354  "ws-rv9x6.cls",
355];
356
357/// TeX Live files whose copy the paper ships under the file's own name is read after their binding, keeping what the
358/// binding declares (OD #731 rule 15). Not stand-ins: with no shipped copy the load is the binding's alone.
359pub const PAPER_COPIES_READ: &[&str] = &["longtable.sty"];
360
361/// Is `file` on [`PAPER_COPIES_READ`], with no user binding ahead of the compiled one?
362pub fn is_a_paper_copy_read(file: &str) -> bool {
363  PAPER_COPIES_READ
364    .iter()
365    .any(|name| name.eq_ignore_ascii_case(file))
366    && crate::state::local_binding_file(file).is_none()
367}
368
369/// Is the paper's copy of `file` read after its binding: a stand-in's ([`stands_in_for_an_author_file`]), or the copy
370/// the paper ships of a TeX Live file on [`PAPER_COPIES_READ`] (`papers_own_copy`, found in the paper's source only)?
371pub fn reads_the_papers_copy(file: &str) -> bool {
372  stands_in_for_an_author_file(file)
373    || (is_a_paper_copy_read(file) && crate::binding::content::papers_own_copy(file).is_some())
374}
375
376/// Is `file` (`arxiv.sty`) the name of a binding that stands in for an author's file? Matched without regard to
377/// case, as the binding registry matches a request (`jhep.cls` → `JHEP.cls`). It stands in on every tree: a paper's copy
378/// is read after it (TeX reads the document's directory first), and where the paper ships none, a later tree's own file
379/// (TL 2026's `rasti.cls`) answers `\IfFileExists` by the disk search made before the binding is asked.
380/// A stand-in is the compiled binding: a user's binding found ahead of it in the search paths (`lipics-v2021.cls.rhai`
381/// beside the document or under `--path`) is the file itself, as Perl's first `.ltxml` found is (Package.pm:2127-2129),
382/// and no copy is read after it (#947).
383pub fn stands_in_for_an_author_file(file: &str) -> bool {
384  AUTHOR_FILE_STAND_INS
385    .iter()
386    .any(|name| name.eq_ignore_ascii_case(file))
387    && crate::state::local_binding_file(file).is_none()
388}