To avoid the problem of having to decide whether to use \newcommand
or \renewcommand
, LaTeX has the option of \providecommand
.
Is there something corresponding to this for environments? I'd like to be able to type \provideenvironment
(or similar) rather than first using \newenvironment
and then using \renewenvironment
.
newX
macro ought to also provide bothrenewX
andprovideX
variants. (I got so fed up of journals defining all different types of theorem variants - and therefore messing up my own definitions - that I wrote a\providetheorem
command.) – Andrew Stacey Jun 14 '11 at 10:07\providecommand
isn't to avoid having to decide which to use, it's to provide a definition if one does not already exist. If it does, then\providecommand
does not redefine it. – TH. Jun 14 '11 at 10:37\providecommand
rather than keep track of whether my LaTeX code has already defined a command (hence the weird way I described its purpose). – bryn Jun 19 '11 at 7:49