Problem with redefining Tabular environment with the \renewenvironment command
A better approach is to define a new tabular environment with your own customizations
\newenvironment{smalltabular}{\footnotesize\tabular}{\endtabular}
And then use smalltabular
instead of tabular
. A few things to note:
- In the definition of a new environment, instead of
\begin{tabular}
and\end{tabular}
it's enough to say\tabular
and\endtabular
. - You don't need to register any arguments for
smalltabular
, because the last command in it's definition (i.e.\tabular
) will already look for and process any arguments appropriately.
If for some reason you really want to redefine the tabular environment, you first need to save its old definition and then redefine it. For example:
\let\oldtabular\tabular
\let\endoldtabular\endtabular
\renewenvironment{tabular}{\footnotesize\oldtabular}{\endoldtabular}
Using the \tabular
macro inside a redefinition of the same macro will produce an infinite loop. Try the following:
\makeatletter
\renewcommand{\tabular}{\let\@halignto\@empty\footnotesize\@tabular}
\makeatother
When you use \renewenvironment, it doesn't expand the new definition until it is used. So in your case, when you call it, it tries to expand the new tabular environment and substitutes the \begin{tabular}, you've included in that one, leading to another one, and so on, leading to an infinite loop.
In general you cannot define an environment or command in terms of itself, unless you're very very careful to ensure that's its recursively well-grounded.
(EDIT: Sorry to duplicate lockstep; we were answering at the same time.)