Generalnewcommand vs newcommand*

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

newcommand vs newcommand*

Post by kaiserkarl13 »

What is the difference between newcommand and newcommand* (or, similarly, renewcommand and renewcommand*)? I read on TeX Frequently Asked Questions that newcommand "defines a \long version of the command," but I'm not certain what they mean.

Perhaps the biggest issue is that I need to learn what \long does....

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

newcommand vs newcommand*

Post by gmedina »

Hi,

The \long prefix indicates that the arguments of the macro being defined may contain \par tokens.

\newcommand* behaves like \newcommand, but it defines a command that is not long; i.e., it does not accept empty lines or \par in its argument.

In TeX terms, \def is equivalent to \newcommand* and \long\def is equivalent to \newcommand.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: newcommand vs newcommand*

Post by josephwright »

For most purposes, you should use \newcommand*. The \long nature of \newcommand is normally not needed for user macros. (In the same way, using the TeX primitives I prefer \def to \long\def unless I really need to accept paragraphs.)
Joseph Wright
Post Reply