### Commands defined with * options

LaTeX commands commonly have "versions" defined with an asterisk tagged onto their name: for example `\``newcommand` and `\``newcommand*` (the former defines a `\``long` version of the command).

The simple-minded way for a user to write such a command involves use of the ifthen package:

>     \newcommand{\mycommand}[1]{\ifthenelse{\equal{#1}{*}}%
>       {\mycommandStar}%
>       {\mycommandNoStar{#1}}%
>     }
>     \newcommand{\mycommandStar}{starred version}
>     \newcommand{\mycommandNoStar}[1]{normal version}

This does the trick, for sufficiently simple commands, but it has various tiresome failure modes, and it requires `\``mycommandnostar` to take an argument.

Of course, the LaTeX kernel has something slicker than this:

>     \newcommand{\mycommand}[1]{\@ifstar
>       \mycommandStar%
>       \mycommandNoStar%
>     }
>     \newcommand{\mycommandStar}{starred version}
>     \newcommand{\mycommandNoStar}{normal version}

Which is all very well, is fast and efficient, but requires the definition to be `\``makeatletter` protected. The technique doesn't interfere at all with the definitions of `\``mycommandStar` or `\``mycommandNoStar`; they can have any combination of optional and mandatory arguments that you could define them to have in the ordinary way.

A pleasing alternative is the suffix package. This elegant piece of code allows you to define variants of your commands:

>     \newcommand\mycommand{normal version}
>     \WithSuffix\newcommand\mycommand*{starred version}

The package needs e-LaTeX, but any new enough distribution defines LaTeX as e-LaTeX by default. Command arguments may be specified in the normal way, in both command definitions (after the "`*`" in the `\``WithSuffix` version). You can also use the TeX primitive commands, creating a definition like:

>     \WithSuffix\gdef\mycommand*{starred version}

`ifthen.sty`
  Part of the LaTeX distribution
`suffix.sty`
  Distributed as part of macros/latex/contrib/bigfoot (gzipped tar, browse)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=cmdstar