Packages for Macros

calc

Allows much simpler syntax for performing arithmetic in macros—infix notation arithmetic in LaTeX.

xifthen

Provides if-then-else control structures in macros, with some extra bells and whistles compared to ifthen.

xspace

The xspace package defines a single macro that handles spacing following a macro you define, making sure to insert a space before the next token unless that token is punctuation.