Index of /support/newcommand
      Name                    Last modified       Size  Description

[DIR] Parent Directory 23-Apr-2017 14:08 - [   ] newcommand.pdf 02-Jun-2010 12:58 395k [   ] 01-Jun-2010 14:06 26k [TXT] newcommand.tex 01-Jun-2010 15:57 23k [   ] 27-Sep-2003 03:09 14k

                |           NEWCOMMAND.PY	     |
		|				     |
                | More flexible argument processing  |
                | than what \newcommand provides     |
		|				     |
                | By Scott Pakin, |


LaTeX's \newcommand is fairly limited in the way it processes optional
arguments, but the TeX alternative, a batch of \defs and \futurelets,
can be overwhelming to the casual LaTeX user. is a
Python program that automatically generates LaTeX macro definitions
for macros that require more powerful argument processing than
\newcommand can handle. is intended for LaTeX advanced
beginners (i.e., those who know how to use \newcommand but not
internal LaTeX2e commands such as \@ifnextchar) and for more advanced
users who want to save some typing when defining complex macros.

With, the user specifies a template for a macro's
arguments. then custom-generates a macro definition
according to the user's specifications and includes a user-friendly
"Put code here" comment to indicate where the macro's main code should
appear. supports arbitrary interleavings of required
and optional arguments, starred macros, mandatory literal text, macros
with more than nine arguments, optional arguments delimited by
parentheses instead of square brackets, and optional arguments whose
value defaults to the value given for a prior argument.  The generated
macros can easily be pasted into a LaTeX document and edited as


You'll need a Python interpreter (  Besides
that, just make sure that is placed somewhere in your
path and that is somewhere that can find it.

Copyright and license

Copyright (C) 2010 Scott Pakin,

This package may be distributed and/or modified under the conditions
of the LaTeX Project Public License, either version 1.3c of this
license or (at your option) any later version.  The latest version of
this license is in:

and version 1.3c or later is part of all distributions of LaTeX version
2006/05/20 or later.