Actually, the “LaTeXbook” (properly “LaTeX. A Document Preparation System”, by Leslie Lamport) endorses the use of such environments: at the end of page 27 we find:
Every declaration has a corresponding environment of the same name
(minus the \
character). Typing
\begin{em} ... \end{em}
is equivalent to typing {\em ... }
.
In particular, the “environmental” form automatically supplies a group to keep the effects of the declaration local, as always happens with environments (\begin
issues a \begingroup
, and \end
the corresponding \endgroup
). Now, \small
is a declaration, so the above applies.
This has been done purposedly, so I don’t deem it correct to say that these environments work “by chance”; indeed, as has already been observed, the lack of a definition of a command like \endsmall
does not rise any problem, because it is called as \csname small\endcsname
and is therefore equivalent to \relax
if undefined.
So, in the end my answer is: “Yes, these environments are ‘real’” (whatever this means).
Addition
After seeing some of the comments, I thought that it might be useful to add some details about how environments are implemented in LaTeX2e (I’m not going to speak of LaTeX3 because I havan’t got enough expertize). Christian Hupfer has already presented the exact code excerpts from latex.ltx
, but perhaps someone will find the following additional remarks useful as well.
When you define environment FOO
, LaTeX simply defines two new commands, \FOO
and \endFOO
: the latter is always without arguments, while the former has the same argument(s), if any, that have been specified for the environment FOO
. When a \begin{FOO}
is encountered, the following things happen (among others):
a group is begun with \begingroup
;
the argument of \begin
(FOO
, in this case) is saved (locally)
in the macro \@currenvir
, to be able to check, later on,
that each \end
is paired with the correct \begin
;
the command \FOO
is executed as the last thing;
thus, it will absorb the arguments that follow \begin{fOO}
,
if they are present.
On the other hand, when LaTeX comes to \end{FOO}
, the following happen (among other things):
\endFOO
is executed, if it is defined
(nothing happens if it is not, as already explained above);
LaTeX checks that the argument of \end
is equal to \@currenvir
and rises an error if not;
an \endgroup
is issued to close the group.
Actually, when I define a new environment based on another, standard one, I prefer to avoid using explicit \begin
and \end
, so that the value of \@currenvir
is not changed. For example, suppose I want to define a variant of the quote
environment that italicizes its contents; I prefer, say,
\newenvironment{italquote}{%
\quote
\itshape
}{\endquote}
over
\newenvironment{italquote}{%
\begin{quote}%
\itshape
}{\end{quote}}
especially if I am not going to use the environment myself. In this way, if users misspell the name of the environment in the \end
statement, they will get an error about an incorrectly terminated italquote
environment, which is what they actually used, not about an incorrectly terminated quote
environment, of which they could be unaware.
\begin{section}...\end{section}
, but you shouldn't\csname
fully explains why they work without any problems. (So it's not just some miracle as you thought in the first place.^^) Still I wonder why it is so easy to use this syntax when it is considered bad practice.