pub fn output_file_name(name: &str) -> StringExpand description
The name TeX writes an output file under. \openout completes a name
without an extension to <name>.tex (tex.web §1374 “if cur_ext=”“ then
cur_ext:=“.tex”“, tex.web:24928), and the extension is what follows the
LAST . after the last / (web2c’s more_name); TeX Live reads a braced
name {…} as its group’s content (scan_file_name_braced). Reads look for
<name>.tex first as well (§537), so \openout\f=notes + \input{notes}
meet in the store either way, while \IfFileExists{notes.tex} only finds
the completed name. Every writer that stands in for \openout — the
primitive, {filecontents} (latex.ltx:18998, :19023), expl3’s
\iow_open:Nn for tcolorbox’s \tcbverbatimwrite, listings’
\lst@WFBegin (lstmisc.sty:61) — names its file through this. Perl stores
the bare name (TeX_FileIO.pool.ltxml:120-126; KNOWN_PERL_ERRORS #279).
Witness latex4wp (latexdemo.sty:97-101 {filecontents*}{democode} then
\IfFileExists{democode.tex}: 98 of 105 words of its examples missing).