22

I vaguely seem to recall reading that \newenvironment* gives better spacing than \newenvironment, but I don't recall any details and I can't seem to find a reference by searching. What is the difference between these two, and when should one be used rather than the other?

[Note: I'll be happy for this to be closed as a duplicate, as long as someone can point to the question of which it is a duplicate; I cannot seem to locate such a question.]

4
  • 3
    The relation is the same as between \newcommand and \newcommand*: if there are arguments to \begin{foo}, then they are allowed to contain empty lines in the former case and aren't in the latter. See tex.stackexchange.com/questions/1050/…
    – egreg
    Dec 10, 2012 at 21:25
  • @egreg: So, to check my understanding: If we are defining a new environment called foo, then using \newenvironment* rather than \newenvironment will have no effect on what is allowed in between \begin{foo} and \end{foo}, but will have an effect on what is allowed inside arguments to \begin{foo}. And there is no effect on spacing. Is this correct? Dec 10, 2012 at 21:34
  • @CharlesStaats Exactly right
    – Joseph Wright
    Dec 10, 2012 at 21:37
  • 5
    So as not to encourage more close votes, there's been further discussion in chat to not close this question as a duplicate. See chat.stackexchange.com/transcript/message/7216046#7216046 and following discussion.
    – Alan Munn
    Dec 10, 2012 at 21:44

1 Answer 1

20

The relation is the same as that between \newcommand and \newcommand*, which is covered in What's the difference between \newcommand and \newcommand*?

There's no influence on the environment's behavior, except as regards to the arguments to \begin{envname}.

Specifically, if you say

\newenvironment{foo}[1]
 {something with #1}
 {something else}

you're allowed to say

\begin{foo}{An argument 

  with a blank line}
The environment's contents

With perhaps a blank line
\end{foo}

while \newenvironment*{foo} wouldn't allow this and the argument should not contain any blank line (or \par command), but the environment's contents has no limitation (other than those possibly imposed by its definition).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .