[latexrefman-commits] r439 - in /trunk: ChangeLog latex2e.texi

jhefferon at domain.hid jhefferon at domain.hid
Fri Sep 18 14:16:43 CEST 2015


Author: jhefferon
Date: Fri Sep 18 14:16:42 2015
New Revision: 439

URL: http://svn.gna.org/viewcvs/latexrefman?rev=439&view=rev
Log:
filecontents corrections

Modified:
    trunk/ChangeLog
    trunk/latex2e.texi

Modified: trunk/ChangeLog
URL: http://svn.gna.org/viewcvs/latexrefman/trunk/ChangeLog?rev=439&r1=438&r2=439&view=diff
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Fri Sep 18 14:16:42 2015
@@ -1,3 +1,7 @@
+2015-09-18  Jim Hefferon  <jhefferon at domain.hid>
+
+	* latex2e.texi (filecontents): Corrections suggested by JB.
+
 2015-09-17  Vincent Belaïche  <vincent.belaiche at domain.hid>
 
 	* ChangeLog: Correct typo on Jim's surname Hefferson->Hefferon.

Modified: trunk/latex2e.texi
URL: http://svn.gna.org/viewcvs/latexrefman/trunk/latex2e.texi?rev=439&r1=438&r2=439&view=diff
==============================================================================
--- trunk/latex2e.texi	(original)
+++ trunk/latex2e.texi	Fri Sep 18 14:16:42 2015
@@ -2574,7 +2574,7 @@
 
 
 @node filecontents
- at domain.hid @code{filecontents}: Create external files
+ at section @code{filecontents}: Write an external file
 
 @findex filecontents
 @cindex external files, creating
@@ -2584,51 +2584,56 @@
 
 @example
 \begin at domain.hid}@}
- at domain.hid}
+  @var{text}
 \end at domain.hid@}
-...
-\documentclass at domain.hid}@}
- at domain.hid example
-
- at domain.hid initial command
- at domain.hid \documentclass, commands before
-The @code{filecontents} environment is an @dfn{initial command},
-meaning that it can be used only before the @code{\documentclass}
-command, as in the synopsis above.
-
- at domain.hid{} will create a file named @var{filename} with the content
- at domain.hid} preceded by a header comment indicating how and
-when the file was generated. If the file already exists then nothing will
-happen.
-
-You can also use the @code{filecontents} package, which has the
-following advantages:
-
- at domain.hid
- at domain.hid
-If the file already exists, then it will be overwritten.
-
- at domain.hid
-You can use the @code{filecontents} environment at any point after the
-declaration @code{\usepackage at domain.hid@}}, not just before
- at domain.hid}.
-
- at domain.hid
-The @code{filecontents} package also provides a @code{filecontents*}
-environment which is used in the same way as the @code{filecontents}
-environment except that it won't insert any leading comment, so it is
-better suited to create files which aren't in @LaTeX{} format.
-
- at domain.hid itemize
-
-The @code{filecontents} environment only creates the file, and is
-unrelated to using the created file.  So you need to use, for
-instance, @code{\input} or @code{\usepackage} or @code{\bibliography}
-or whatever is applicable, to use the created file.
-
-This environment is also useful to make a document in a self-contained
-file, for example, for a bug report, or to keep the content of a
- at domain.hid} file in the same file as the main document.
+ at end example
+
+or
+
+ at example
+\begin at domain.hid}@}
+  @var{text}
+\end at domain.hid*@}
+ at end example
+
+Create a file named @var{filename} and fill it with @var{text}.  The
+unstarred version of the environment @code{filecontents} prefixes the
+created file with a header; see the example below.  The starred version
+ at code{filecontents*} does not include the header.
+
+This environment can be used anywhere in the preamble, although it often
+appears before the @code{\documentclass} command.  It is typically used
+when a source file requires a nonstandard style or class file.  The
+environment will write that file to the directory containing the source
+and thus make the source file self-contained.  Another use is to include
+ at code{bib} references in the file, again to make it self-contained.
+
+The environment checks whether a file of that name already exists and if
+so, does not do anything.  There is a @file{filecontents} package, which
+instead of doing nothing in that case, will overwrite the existing file.
+
+For example, this document
+
+ at example
+\documentclass at domain.hid@}
+\begin at domain.hid@}
+\newcommand at domain.hid Hef at domain.hid@}
+\end at domain.hid@}
+\usepackage at domain.hid@}
+\begin at domain.hid@}
+Article by \myname.
+\end at domain.hid@}
+ at end example
+
+produces this file @file{JH.sty}.
+
+ at example
+%% LaTeX2e file `JH.sty'
+%% generated by the `filecontents' environment
+%% from source `test' on 2015/10/12.
+%%
+\newcommand at domain.hid Hef at domain.hid@}
+ at end example
 
 
 @node flushleft





More information about the latexrefman-commits mailing list