summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-04-24 23:58:20 +0000
committerKarl Berry <karl@freefriends.org>2007-04-24 23:58:20 +0000
commit372e8497bf41d3fe0563c5c44fac9957c553a376 (patch)
treeff72cd23185aebdbf816380f6f3fbb404c00b1dd
parent6d57ece139d5b666d50415ba2465a992b805b3f4 (diff)
new latex package xnewcommand (23apr07)
git-svn-id: svn://tug.org/texlive/trunk@4185 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/tools/tpm-ctan-check2
-rw-r--r--Master/texmf-dist/doc/latex/xnewcommand/README10
-rw-r--r--Master/texmf-dist/doc/latex/xnewcommand/xnewcommand.pdfbin0 -> 275079 bytes
-rw-r--r--Master/texmf-dist/doc/latex/xnewcommand/xnewcommand.tex153
-rw-r--r--Master/texmf-dist/tex/latex/xnewcommand/xnewcommand.sty16
-rw-r--r--Master/texmf-dist/tpm/xnewcommand.tpm27
-rw-r--r--Master/texmf/lists/xnewcommand8
-rw-r--r--Master/texmf/tpm/collection-latexextra.tpm1
8 files changed, 216 insertions, 1 deletions
diff --git a/Build/tools/tpm-ctan-check b/Build/tools/tpm-ctan-check
index 6bbf9bf1122..0c483ee1e9e 100755
--- a/Build/tools/tpm-ctan-check
+++ b/Build/tools/tpm-ctan-check
@@ -121,7 +121,7 @@ my @WorkingTPM = qw(
vancouver variations varindex vector velthuis verse versions
vhistory visualfaq vmargin volumes vpe
wallpaper warning warpcol williams wordlike wrapfig
- xtcapts xcolor xifthen xkeyval xq xtab xyling xypic-tut-pt
+ xcolor xifthen xkeyval xnewcommand xq xtab xtcapts xyling xypic-tut-pt
xytree
york-thesis
);
diff --git a/Master/texmf-dist/doc/latex/xnewcommand/README b/Master/texmf-dist/doc/latex/xnewcommand/README
new file mode 100644
index 00000000000..5bb8aabe6a4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xnewcommand/README
@@ -0,0 +1,10 @@
+For most purposes, the features of \newcommand suffice. Nonetheless,
+\newcommand lacks some interesting features like the ability to make
+definition global or to use the \protected prefix supplied by
+e-TEX. This--surprisingly small--package makes possible to pass an
+optional argument \newcommand so that is becomes possible to use the
+\global and \protected prefixes.
+
+This material is subject to the LaTeX Project Public License.
+See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
+for the details of that license.
diff --git a/Master/texmf-dist/doc/latex/xnewcommand/xnewcommand.pdf b/Master/texmf-dist/doc/latex/xnewcommand/xnewcommand.pdf
new file mode 100644
index 00000000000..08e7d055700
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xnewcommand/xnewcommand.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/xnewcommand/xnewcommand.tex b/Master/texmf-dist/doc/latex/xnewcommand/xnewcommand.tex
new file mode 100644
index 00000000000..0c637fe14a0
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xnewcommand/xnewcommand.tex
@@ -0,0 +1,153 @@
+\documentclass{article}
+
+\usepackage{etex}
+\usepackage[ascii]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[warn]{textcomp}
+\usepackage[a4paper, pdftex, margin=1.5in]{geometry}
+\usepackage{lmodern}
+\usepackage{typetex}
+\usepackage{xnewcommand}
+\usepackage{microtype}
+\usepackage{xcolor}
+\usepackage{url}
+\usepackage[bottom,hang]{footmisc}
+\usepackage[babel]{csquotes}
+\usepackage[british]{babel}
+\usepackage{hyperref}
+
+\setcounter{secnumdepth}{-\maxdimen}
+
+\newcommand*{\setdate}{}
+\def \setdate #1/#2/#3#4{%
+ \year = #1
+ \month = #2
+ \day = #3#4
+}
+
+\makeatletter
+\newcommand*{\getfileinfo}[1]{%
+ \def \filename {#1}%
+ \def \@tempb ##1 ##2 ##3\relax ##4\relax {%
+ \def \filedate {##1}%
+ \def \fileversion {##2}%
+ \def \fileinfo {##3}%
+ }%
+ \edef \@tempa {\csname ver@#1\endcsname}%
+ \expandafter \@tempb \@tempa \relax ? ? \relax \relax
+}
+\makeatother
+
+\newcommand*{\pack}{\textsf}
+
+\title {The \pack{xnewcommand} package}
+\author {Josselin Noirel\\\url{http://www.jnoirel.fr/}}
+\date {%
+ \getfileinfo{xnewcommand.sty}%
+ \expandafter \setdate \filedate
+ \today\ (\fileversion)}
+
+\begin{document}
+
+\maketitle
+
+\tableofcontents
+
+\begin{abstract}
+ For most purposes, the features of \cmd{newcommand} suffice.
+ Nonetheless, \cmd{newcommand} lacks some interesting features like
+ the ability to make definition global or to use the \cmd{protected}
+ prefix supplied by \eTeX. This---surprisingly small---package makes
+ possible to pass an~optional argument \cmd{newcommand} so that is
+ becomes possible to use the \cmd{global} and \cmd{protected}
+ prefixes.
+\end{abstract}
+
+\section{Usage}
+
+Load the package with
+%
+\begin{texcode}
+ \cmd[1]{usepackage}{xnewcommand}
+\end{texcode}
+%
+Then \cmd{newcommand} can take an additional optional argument:
+%
+\begin{texcode}
+ \cmd[syntax,5]{newcommand}[prefix]{command}[number][default]{definition}
+\end{texcode}
+%
+where \meta{prefix} can be any valid prefix or combination of them:
+%
+\begin{description}
+\item [\cmd{long}] The command will accept `long arguments', in
+ other words, its arguments may contain ends
+ of paragraph (explicit \cmd{par} or empty
+ lines);
+
+\item [\cmd{global}] The command is defined globally, in other
+ words, the definition won't be confined to
+ the current group;
+
+\item [\cmd{protected}] The command will be robust in moving
+ arguments and won't undergo systematic
+ expansion at the beginning of tabular cells;
+
+\item [\cmd{outer}] Makes the macro \cmd{outer} (not very useful,
+ but included for the sake of completeness).
+\end{description}
+
+The same syntax applies to the commands \cmd{renewcommand},
+\cmd{DeclareRobustCommand}, \cmd{newenvironment} and
+\cmd{renewenvironment}.
+
+\section{Remarks}
+
+It should not break anything. The normal syntax is preserved:
+%
+\begin{texcode}
+\cmd[syntax,2]{newcommand}{command}{definition}
+\end{texcode}
+%
+is equivalent to
+%
+\begin{texcode}
+\cmd[3]{newcommand}[\cmd{long}]{\<command\>}{\<definition\>}
+\end{texcode}
+%
+and
+%
+\begin{texcode}
+\cmd[syntax,2]{newcommand}*{command}{definition}
+\end{texcode}
+%
+is equivalent to
+%
+\begin{texcode}
+\cmd[3]{newcommand}[]{\<command\>}{\<definition\>}
+\end{texcode}
+%
+Any macro that uses \cmd{star@or@long} will inheritate the features
+described above.
+
+\section{Examples}
+
+Global definition:
+%
+\begin{texcode}
+\cmd{newcommand}[\cmd{global}]\marg{command}\marg{definition}
+\end{texcode}
+%
+Protected definition:
+%
+\begin{texcode}
+\cmd{newcommand}[\cmd{protected}]\marg{command}\marg{definition}
+\end{texcode}
+%
+Combination of both:
+%
+\begin{texcode}
+\cmd{newcommand}[\cmd{global} \cmd{protected}]\marg{command}\marg{definition}
+\end{texcode}
+
+\end{document}
diff --git a/Master/texmf-dist/tex/latex/xnewcommand/xnewcommand.sty b/Master/texmf-dist/tex/latex/xnewcommand/xnewcommand.sty
new file mode 100644
index 00000000000..69c70e12aa5
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/xnewcommand/xnewcommand.sty
@@ -0,0 +1,16 @@
+% $Date: 2007-04-23 17:32:09 +0200 (Mon, 23 Apr 2007) $
+% $Revision: 42 $
+\def \filedate {2007/04/21}
+\def \fileversion {v1.2}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{xnewcommand}%
+ [\filedate \space \fileversion \space Improved newcommand (JN)]
+
+\def \@star@or@long #1{%
+ \@ifstar {\let \l@ngrel@x = \relax #1}%
+ {\@testopt {\@@star@or@long {#1}}{\long}}%
+}
+\@ifdefinable \@@star@or@long
+ {\def \@@star@or@long #1[#2]{\def \l@ngrel@x {#2}#1}}
+
+\endinput
diff --git a/Master/texmf-dist/tpm/xnewcommand.tpm b/Master/texmf-dist/tpm/xnewcommand.tpm
new file mode 100644
index 00000000000..70b40443a2e
--- /dev/null
+++ b/Master/texmf-dist/tpm/xnewcommand.tpm
@@ -0,0 +1,27 @@
+<!DOCTYPE rdf:RDF SYSTEM "../../support/tpm.dtd">
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:TPM="http://texlive.dante.de/">
+ <rdf:Description about="http://texlive.dante.de/texlive/Package/xnewcommand.zip">
+ <TPM:Name>xnewcommand</TPM:Name>
+ <TPM:Type>Package</TPM:Type>
+ <TPM:Date>2007/04/23 14:34:00</TPM:Date>
+ <TPM:Version></TPM:Version>
+ <TPM:Creator>karl</TPM:Creator>
+ <TPM:Title>The xnewcommand package.</TPM:Title>
+ <TPM:Description></TPM:Description>
+ <TPM:Author></TPM:Author>
+ <TPM:Size>279936</TPM:Size>
+ <TPM:License></TPM:License>
+ <TPM:Build/>
+ <TPM:RunFiles size="1466">
+texmf-dist/tex/latex/xnewcommand/xnewcommand.sty
+texmf-dist/tpm/xnewcommand.tpm
+ </TPM:RunFiles>
+ <TPM:DocFiles size="279466">
+texmf-dist/doc/latex/xnewcommand/README
+texmf-dist/doc/latex/xnewcommand/xnewcommand.pdf
+texmf-dist/doc/latex/xnewcommand/xnewcommand.tex
+ </TPM:DocFiles>
+ <TPM:Provides>Package/xnewcommand</TPM:Provides>
+ </rdf:Description>
+</rdf:RDF>
+
diff --git a/Master/texmf/lists/xnewcommand b/Master/texmf/lists/xnewcommand
new file mode 100644
index 00000000000..a3814b51195
--- /dev/null
+++ b/Master/texmf/lists/xnewcommand
@@ -0,0 +1,8 @@
+texmf-dist/doc/latex/xnewcommand/README
+texmf-dist/doc/latex/xnewcommand/xnewcommand.pdf
+texmf-dist/doc/latex/xnewcommand/xnewcommand.tex
+
+texmf-dist/tex/latex/xnewcommand/xnewcommand.sty
+texmf-dist/tpm/xnewcommand.tpm
+
+texmf/lists/xnewcommand
diff --git a/Master/texmf/tpm/collection-latexextra.tpm b/Master/texmf/tpm/collection-latexextra.tpm
index 67331899c5e..89861b12bf8 100644
--- a/Master/texmf/tpm/collection-latexextra.tpm
+++ b/Master/texmf/tpm/collection-latexextra.tpm
@@ -525,6 +525,7 @@ A large collection of add-on packages for LaTeX.
<TPM:Package name="xdoc"/>
<TPM:Package name="xifthen"/>
<TPM:Package name="xmpincl"/>
+ <TPM:Package name="xnewcommand"/>
<TPM:Package name="xytree"/>
<TPM:Package name="yafoot"/>
<TPM:Package name="yplan"/>