[Tex/LaTex] What are the consideration when choosing either newcommand or newenvironment

best practicesenvironmentsmacros

The first time I learnt LaTeX, I thought \newcommand properly fits for inline mode and \newenvironment for displayed mode.

Later I noticed it is not correct. So the question is

What is the rule of thumb when deciding whether we should use one over the other one?

Best Answer

Technical reasons for choosing an environment over a command form are that if the definition only involves setting up declarations then it never has to scan the content in advance, so list environments or longtable etc can start typesetting and shipping out pages before the end of the environment is seen. A command form necessarily has to scan to the end of the argument. If there is the possibility of verbatim-like material it is again easier to use an environment form.

Other reasons are mostly just to do with the aesthetics of the document structure you are defining. If you want to think of it as a scoped region define it as an environment. If you want to think of it as a block of text passed to a command, define it as a command.

Related Question