[comp.text.tex] \newenvironment and equations

smagt@fwi.uva.nl (Patrick van der Smagt) (05/10/91)

Please help me!  I can't figure it out.  When I define
--------------
\newenvironment{teq}{\begin{equation}}{\end{equation}}
\begin{teq}
x^2 + y^2 = c^2,
\end{teq}
To get the correct generalisation of the rule as
presented in the previous chapter, we must set
--------------

the line following this displayed equation is indented by a
space.  In this specific case, the output of dvitty is

--------------
                      x2 +y2= c2;                    (1)

 To get the correct generalisation of the rule as presented in the
previous chapter, we must set
--------------

This looks like a bug in \newenvironment, or is this a
feature of one of those wonderful LaTeX commands?

						Patrick van der Smagt

texinfo1@rusmv1.rus.uni-stuttgart.de (Rainer Schoepf) (05/11/91)

In article <1991May10.065801.20125@fwi.uva.nl> smagt@fwi.uva.nl (Patrick van der Smagt) writes:
>Please help me!  I can't figure it out.  When I define
>--------------
>\newenvironment{teq}{\begin{equation}}{\end{equation}}
>\begin{teq}
>x^2 + y^2 = c^2,
>\end{teq}
>To get the correct generalisation of the rule as
>presented in the previous chapter, we must set
>--------------
>
>the line following this displayed equation is indented by a
>space.  In this specific case, the output of dvitty is
>
>--------------
>                      x2 +y2= c2;                    (1)
>
> To get the correct generalisation of the rule as presented in the
>previous chapter, we must set
>--------------
>
>This looks like a bug in \newenvironment, or is this a
>feature of one of those wonderful LaTeX commands?
>
>						Patrick van der Smagt


You have a space (actually an end-of-line) after your

\end{teq}

and consequently, you get a space in the output. 

This behaviour is the same for every LaTeX environment, except for a few
special ones (like equation) that explicitly discard spaces following their
\end tag.

[Classified information: this is done by setting a global switch to true,
 with the name of `@ignore'. The \end command checks that switch and
 calls TeX's \ignorespaces primitive, if necessary.]

Rainer Sch\"opf