TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

LaTeX2e provides a \providecommand but there is no \provideenvironment which defines an environment only if it (or a macro with the same name) was not defined before. Is there a specific reason why it is missing?

share|improve this question
up vote 27 down vote accepted

This is the kind of question that is fairly difficult to answer after 20 years. But basically because it was not considered so important. One has to remember that the implementation of 2e was guided by space and speed restriction, So initially we spend an enormous amount of time optimizing the kernel for speed and space.

2e introduced a lot of new code (like NFSS, the package loading mechanism, amsmath etc) but the available main memory was what it was for LaTeX2.09. So compromises had to be made. In fact for quite a long time we even maintained an "auto-load" version of the kernel where a lot of functionality wasn't precompiled into it but only loaded on demand.

Now \providecommand was made available because you often have simple user commands where "better" implementations might be provided by a package and then you do not want your code to overwrite things. Environments are typically more elaborate and thus less likely to be of that nature and we simply didn't saw the big benefit of providing the same mechanism there and wasting space.

Wrong judgement? Perhaps. On the other hand, I personally never felt that \providecommand, except in very restricted circumstances, is really something you should use as it is better to know if something overwrites something else and then make a concious decision which version to use.

share|improve this answer
I personally only really use \providecommand when I might be passing input from other sources that should override a default definition. Such as pdflatex "\def\FLAG{T}\input{myfile}", in which myfile.tex has a flag defined with some default like \providecommand\FLAG{F} that can be redefined as desired. – Will Robertson May 21 '12 at 8:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.