| 1 |
+------------------------------------+ |
| 2 |
| NEWCOMMAND.PY | |
| 3 |
| | |
| 4 |
| More flexible argument processing | |
| 5 |
| than what \newcommand provides | |
| 6 |
| | |
| 7 |
| By Scott Pakin, [email protected] | |
| 8 |
+------------------------------------+ |
| 9 |
|
| 10 |
|
| 11 |
Description |
| 12 |
----------- |
| 13 |
|
| 14 |
LaTeX's \newcommand is fairly limited in the way it processes optional |
| 15 |
arguments, but the TeX alternative, a batch of \defs and \futurelets, |
| 16 |
can be overwhelming to the casual LaTeX user. newcommand.py is a |
| 17 |
Python program that automatically generates LaTeX macro definitions |
| 18 |
for macros that require more powerful argument processing than |
| 19 |
\newcommand can handle. newcommand.py is intended for LaTeX advanced |
| 20 |
beginners (i.e., those who know how to use \newcommand but not |
| 21 |
internal LaTeX2e commands such as \@ifnextchar) and for more advanced |
| 22 |
users who want to save some typing when defining complex macros. |
| 23 |
|
| 24 |
With newcommand.py, the user specifies a template for a macro's |
| 25 |
arguments. newcommand.py then custom-generates a macro definition |
| 26 |
according to the user's specifications and includes a user-friendly |
| 27 |
"Put code here" comment to indicate where the macro's main code should |
| 28 |
appear. newcommand.py supports arbitrary interleavings of required |
| 29 |
and optional arguments, starred macros, mandatory literal text, macros |
| 30 |
with more than nine arguments, optional arguments delimited by |
| 31 |
parentheses instead of square brackets, and optional arguments whose |
| 32 |
value defaults to the value given for a prior argument. The generated |
| 33 |
macros can easily be pasted into a LaTeX document and edited as |
| 34 |
desired. |
| 35 |
|
| 36 |
|
| 37 |
Installation |
| 38 |
------------ |
| 39 |
|
| 40 |
You'll need a Python interpreter (http://www.python.org/). Besides |
| 41 |
that, just make sure that newcommand.py is placed somewhere in your |
| 42 |
path and that spark.py is somewhere that newcommand.py can find it. |
| 43 |
|
| 44 |
|
| 45 |
Copyright and license |
| 46 |
--------------------- |
| 47 |
|
| 48 |
Copyright (C) 2010 Scott Pakin, [email protected] |
| 49 |
|
| 50 |
This package may be distributed and/or modified under the conditions |
| 51 |
of the LaTeX Project Public License, either version 1.3c of this |
| 52 |
license or (at your option) any later version. The latest version of |
| 53 |
this license is in: |
| 54 |
|
| 55 |
http://www.latex-project.org/lppl.txt |
| 56 |
|
| 57 |
and version 1.3c or later is part of all distributions of LaTeX version |
| 58 |
2006/05/20 or later. |