The filecontents
package was an extension to the filecontents
environment already present in the LaTeX kernel for many years. LaTeX's version of the environment didn't allow it to be used outside of the document preamble and didn't allow overwriting files. The purpose of the filecontents
package was, as stated in its documentation, to lift these two restrictions.
In the 2019-10-01 version of the LaTeX kernel, the filecontents
environment was changed so that the two restrictions above do not exist anymore, so Scott Pakin, the author of the package, made it so that if filecontents
is loaded in this new version of the LaTeX kernel, the loading of the package is aborted with a warning (no harm done, though).
The new version of the filecontens
environment is backwards compatible with the old version: old documents which relied on the environment being incapable of overwriting will still work. The new version has an optional argument:
\begin{filecontents}[<options>]{<filename>}
The list of <options>
accepts:
overwrite
: This option allows the target <filename>
to be written even if the file exists somewhere in the search tree. Without this option the file will not be written if either a) the file exists in the current folder or b) the file exists somewhere TeX can find (for instance, a file with the same name as a package). In any case, the environment will refuse to write on \jobname.tex
, even if overwrite
is used.
nosearch
: This option will make the environment search for possible file conflicts only in the working directory, so it will only report an overwrite if the file being written to exists in the current folder.
noheader
: This option suppresses the standard:
%% LaTeX2e file `./<filename>'
%% generated by the `filecontents' environment
%% from source `test' on 2019/10/08.
%%
header written at the beginning of the output file. This option does the same as the starred form of the environment, filecontents*
.
You can read more about the change to the filecontents
environment and other changes to the LaTeX kernel in the 2019-10-01 update in ltnews30
.
filecontents
package (and some more) were integrated to the kernel. Seeltnews30
.