[latexrefman-commits] r348 - in /trunk: ChangeLog latex2e.texi
jhefferon at domain.hid
jhefferon at domain.hid
Fri May 29 12:01:19 CEST 2015
Author: jhefferon
Date: Fri May 29 12:01:19 2015
New Revision: 348
URL: http://svn.gna.org/viewcvs/latexrefman?rev=348&view=rev
Log:
add \providecommand
Modified:
trunk/ChangeLog
trunk/latex2e.texi
Modified: trunk/ChangeLog
URL: http://svn.gna.org/viewcvs/latexrefman/trunk/ChangeLog?rev=348&r1=347&r2=348&view=diff
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Fri May 29 12:01:19 2015
@@ -1,3 +1,7 @@
+2015-05-29 Jim Hefferon <jhefferon at domain.hid>
+
+ * latex2e.texi (\providecommand): Add node.
+
2015-05-28 Jim Hefferon <jhefferon at domain.hid>
* latex2e.texi (\newcommand & \renewcommand): Realized environments
Modified: trunk/latex2e.texi
URL: http://svn.gna.org/viewcvs/latexrefman/trunk/latex2e.texi?rev=348&r1=347&r2=348&view=diff
==============================================================================
--- trunk/latex2e.texi (original)
+++ trunk/latex2e.texi Fri May 29 12:01:19 2015
@@ -3700,6 +3700,7 @@
@menu
* \newcommand & \renewcommand:: (Re)define a new command.
+* \providecommand:: Define a new command, if name not used.
* \newcounter:: Define a new counter.
* \newlength:: Define a new length.
* \newsavebox:: Define a new box.
@@ -3753,10 +3754,11 @@
@var{\cmd} does not take an optional argument.
That is, if @var{\cmd} is used with square brackets following, as in
- at domain.hid}]}, then within @var{defn} @code{#1}
-expands @var{myval}. While if @var{\cmd} is called without square
-brackets following, then within @var{defn} the @code{#1} expands to
-the default @var{optargdefault}.
+ at code{\@var{cmd}[@var{myval}]}, then within @var{defn} @code{#1} expands
+ at var{myval}. While if @var{\cmd} is called without square brackets
+following, then within @var{defn} the @code{#1} expands to the default
+ at var{optargdefault}. In either case, any required arguments will be
+referred to starting with @code{#2}.
Omitting @code{[@var{myval}]} in the call is different from having the
square brackets with no contents, as in @code{[]}. The former results
@@ -3817,7 +3819,27 @@
@code{\newcommand at domain.hid #1@}@}} fixes it.
@c xx \ensuremath, ?xspace or at least some comment about swallowing a space.
- at domain.hid xx \providecommand, * form (non-\long)
+ at node \providecommand
+ at section @code{\providecommand}
+ at findex \providecommand
+ at cindex commands, defining new ones
+ at cindex defining a new command
+ at cindex new commands, defining
+
+Defines a command, as long as no command of this name already exists.
+Synopses:
+
+ at example
+\providecommand at domain.hid}@}
+\providecommand*@{@var{cmd}@}[@var{nargs}][@var{optargdefault}]@{@var{defn}@}
+ at end example
+
+If no command of this name already exists then this has the same effect
+as @code{\newcommand} (@pxref{\newcommand & \renewcommand}). If a
+command of this name already exists then this definition does nothing.
+This is particularly useful in a style file, or other file that may be
+loaded more than once.
+
@node \newcounter
@section @code{\newcounter}
@@ -3931,7 +3953,9 @@
the enviroment @code{#1} expands @var{myval}. If
@code{\begin at domain.hid}@}} is called without square brackets following,
then within the environment the @code{#1} expands to the default
- at domain.hid}.
+ at var{optargdefault}. In either case, any required arguments will be
+referred to starting with @code{#2}.
+
Omitting @code{[@var{myval}]} in the call is different from having the
square brackets with no contents, as in @code{[]}. The former results
@@ -3950,10 +3974,10 @@
@end table
-The braces around @var{defn} delimit the scope of the result of
-expanding @var{defn}. Thus, in the first example below, the effect of
-the @code{\small} is limited to the quote and does not extend to
-material following the environment.
+The environment @var{env} delimits the scope of the result of expanding
+ at var{begdefn} and @var{enddefn}. Thus, in the first example below, the
+effect of the @code{\small} is limited to the quote and does not extend
+to material following the environment.
This example gives an environment like @LaTeX{}'s @code{quotation} except that
it will be set in smaller type.
More information about the latexrefman-commits
mailing list