summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBuild/tools/tpm-ctan-check3
-rw-r--r--Master/texmf-dist/doc/latex/xoptarg/README8
-rw-r--r--Master/texmf-dist/doc/latex/xoptarg/xoptarg.pdfbin0 -> 383323 bytes
-rw-r--r--Master/texmf-dist/doc/latex/xoptarg/xoptarg.tex199
-rw-r--r--Master/texmf-dist/tex/latex/xoptarg/xoptarg.sty225
-rw-r--r--Master/texmf-dist/tpm/xoptarg.tpm27
-rw-r--r--Master/texmf/lists/xoptarg8
-rw-r--r--Master/texmf/tpm/collection-latexextra.tpm1
8 files changed, 470 insertions, 1 deletions
diff --git a/Build/tools/tpm-ctan-check b/Build/tools/tpm-ctan-check
index 0c483ee1e9e..da700966c35 100755
--- a/Build/tools/tpm-ctan-check
+++ b/Build/tools/tpm-ctan-check
@@ -121,7 +121,8 @@ my @WorkingTPM = qw(
vancouver variations varindex vector velthuis verse versions
vhistory visualfaq vmargin volumes vpe
wallpaper warning warpcol williams wordlike wrapfig
- xcolor xifthen xkeyval xnewcommand xq xtab xtcapts xyling xypic-tut-pt
+ xcolor xifthen xkeyval xnewcommand xoptarg
+ xq xtab xtcapts xyling xypic-tut-pt
xytree
york-thesis
);
diff --git a/Master/texmf-dist/doc/latex/xoptarg/README b/Master/texmf-dist/doc/latex/xoptarg/README
new file mode 100644
index 00000000000..78365c94bf2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xoptarg/README
@@ -0,0 +1,8 @@
+Because they rely on the \futurelet primitive, the macros with
+optional arguments cannot be expandable. However, it is possible to
+make them expandable if there is at least one mandatory argument (see
+`Limitations').
+
+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/xoptarg/xoptarg.pdf b/Master/texmf-dist/doc/latex/xoptarg/xoptarg.pdf
new file mode 100644
index 00000000000..fa8e2ca0a37
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xoptarg/xoptarg.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/xoptarg/xoptarg.tex b/Master/texmf-dist/doc/latex/xoptarg/xoptarg.tex
new file mode 100644
index 00000000000..38111b7c864
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xoptarg/xoptarg.tex
@@ -0,0 +1,199 @@
+\documentclass{article}
+
+\usepackage{etex}
+\usepackage{xifthen}
+\usepackage[ascii]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[warn]{textcomp}
+\usepackage[a4paper, pdftex, margin=1.5in]{geometry}
+\usepackage{lmodern}
+\usepackage{typetex}
+\usepackage{xoptarg}
+\usepackage{microtype}
+\usepackage{xcolor}
+\usepackage{url}
+\usepackage[bottom,hang]{footmisc}
+\usepackage[babel]{csquotes}
+\usepackage[british]{babel}
+\usepackage{hyperref}
+
+\setcounter{secnumdepth}{-\maxdimen}
+
+\newcommand*{\pack}{\textsf}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newenvironment*{display}{%
+ \list{}{}%
+ \item \relax
+}{%
+ \endlist
+}
+
+\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
+}
+
+\newcommand*{\TypeOut}[1]{%
+ \texttt{%
+ \frenchspacing
+ \begingroup
+ \let \protect = \string
+ \xdef \@gtempa {#1}%
+ \endgroup
+ \let \@tempa = \@gtempa
+ \@onelevel@sanitize \@tempa \@tempa}%
+}
+\makeatother
+
+\title {The \pack{xoptarg} Package}
+\author {Josselin Noirel\\\url{http://www.jnoirel.fr/}}
+\date {%
+ \getfileinfo{xoptarg.sty}
+ \expandafter \setdate \filedate
+ \today\ (\fileversion)}
+
+\begin{document}
+
+\maketitle
+
+\begin{abstract}
+ Because they rely on the \cmd{futurelet} primitive, the macros with
+ optional arguments cannot be expandable. However, it is possible to
+ make them expandable if there is at least one mandatory argument
+ (see `Limitations').
+\end{abstract}
+
+\tableofcontents
+
+\section{Introduction}
+
+\newcommand*{\cmda}[1]{1. #1 2. #1 3. #1 4. #1}
+\newcommand*{\cmdb}[3]{[#1#2#3 #1#3#2 #2#1#3 #2#3#1 #3#1#2 #3#2#1]}
+\newcommand*{\cmdc}[2][X]{(#1,#2)}
+
+Normal macros are expandable:
+%
+\begin{texcode}
+\cmd[3]{newcommand}*{\cmd{cmda}}[1]{1. \#1 2. \#1 3. \#1 4. \#1} \newline
+\cmd[3]{newcommand}*{\cmd{cmdb}}[3]{[\#1\#2\#3 \#1\#3\#2 \#2\#1\#3
+ \#2\#3\#1 \#3\#1\#2 \#3\#2\#1]} \newline
+\end{texcode}
+%
+`Expandable' means that if you print them on the terminal with
+\cmd{typeout}
+%
+\begin{texcode}
+\cmd[1]{typeout}{\cmd[1]{cmda}{Test}...and \cmd[3]{cmdb}{T}{h}{e} rest} \par
+\end{texcode}
+%
+it will result in the processed message which is printed during the
+compilation:
+%
+\begin{display}
+\TypeOut{\cmda{Test}...and \cmdb{T}{h}{e} rest}
+\typeout{TEST>>> \cmda{Test}...and \cmdb{T}{h}{e} rest}
+\end{display}
+
+But, commands defined to take an optional argument behave
+differently. The code:
+%
+\begin{texcode}
+\cmd[3]{newcommand}*{\cmd{cmdc}}[2][X]{(\#1,\#2)} \newline
+\cmd[1]{typeout}{\cmd[2]{cmdc}[A]{B} \cmd[1]{cmdc}{C}}
+\end{texcode}
+%
+prints the unprocessed
+%
+\begin{display}
+\TypeOut{\cmdc[A]{B} \cmdc{C}}
+\typeout{TEST>>> \cmdc[A]{B} \cmdc{C}}
+\end{display}
+%
+and not \tex{(A,B)~(X,C)}! (Of course, in typesetting context, it
+doesn't make any difference\dots\ the interest of the package lies
+in the expandability in moving-argument contexts.) The \pack{xoptarg}
+helps you to make your macros expandable even when they take an
+optional argumen (see `Limitations' though).
+
+\section{Usage}
+
+\subsection{Defining commands}
+
+Your macros, including those that take an optional argument can be
+expandable provided they also take at least one mandatory
+argument\footnote{If your macros don't take any optional argument, the
+ standard behaviour prevails so that you don't to have to worry about
+ them. The `at least one mandatory argument' condition applies only
+ when the macro takes an optional argument.}. Practically spoken,
+your command, when it takes an optional argument, must take at least
+two arguments in total\footnote{A~second requirement is that the
+ mandatory arguments be surrounded by explicit braces \tex{\{\dots\}}.}.
+
+Load the package with
+%
+\begin{texcode}
+\cmd[1]{usepackage}{xoptarg}
+\end{texcode}
+%
+then, instead of using \cmd{newcommand}, use \cmd{xnewcommand}
+%
+\begin{texcode}
+\cmd[4]{xnewcommand}*{\<command\>}[$n$][\<default\>]{\<definition\>}
+\end{texcode}
+%
+This is the same syntax as \cmd{newcommand}'s and it works even if the
+command does take any optional argument. A~normal, non-expandable,
+macro is defined when you define a~macro that takes one optional argument
+and no mandatory one. A~warning is issued to inform you that it won't
+be possible to make it expandable\footnote{The command will be made
+ robust using \cmd{protected} if \eTeX\ is available.}.
+
+\subsection{Changing the prefix}
+
+This package uses \pack{newcommand} that allows a~more sophisticated
+syntax:
+%
+\begin{texcode}
+\cmd[5]{xnewcommand}[\<prefix\>]{\<command\>}[$n$][\<default\>]{\<definition\>}
+\end{texcode}
+%
+For instance, to define a~macro globally, use
+%
+\begin{texcode}
+\cmd[3]{xnewcommand}[\cmd{global}]{\<command\>}{\<definition\>}
+\end{texcode}
+%
+(But \cmd{newcommand} would do the job as well, as \pack{newcommand}
+improves it also.)
+
+\section{Limitations}
+
+The limitations of the package are the following:
+%
+\begin{itemize}
+\item To be expandable, the macros with an optional argument must have
+ at least one mandatory argument.
+
+\item The mandatory arguments must be surrounded by braces in this
+ case.
+
+\item There is no \cmd{rexnewcommand} command.
+\end{itemize}
+
+\end{document}
diff --git a/Master/texmf-dist/tex/latex/xoptarg/xoptarg.sty b/Master/texmf-dist/tex/latex/xoptarg/xoptarg.sty
new file mode 100644
index 00000000000..d76cfe9f474
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/xoptarg/xoptarg.sty
@@ -0,0 +1,225 @@
+% $Date: 2007-04-22 12:22:27 +0200 (Sun, 22 Apr 2007) $
+% $Revision: 39 $
+\def \filedate {2007/04/22}
+\def \fileversion {v1.0}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{xoptarg}%
+ [\filedate \space \fileversion \space Expandable optional-argument macros (JN)]
+
+\ifx \eTeXversion \@undefined
+ \PackageWarning{xoptarg}{%
+ This package works best with e-TeX\MessageBreak
+ for its \protect\protected \space feature%
+ }%
+ \let \XOA@protected = \relax
+\else
+ \let \XOA@protected = \protected
+\fi
+
+\RequirePackage{newcommand}
+
+%% \newcommand*{\xnewcommand}{%
+%% \@ifstar {\XOA@xnewcommand[\def]}%
+%% {\@testopt{\XOA@xnewcommand}{\long \def}}%
+%% }
+
+\newcommand*{\xnewcommand}{\@star@or@long \XOA@xnewcommand}
+
+\newcommand*{\XOA@xnewcommand}{}
+\newcommand*{\XOA@@xnewcommand}{}
+\newcommand*{\XOA@@@xnewcommand}{}
+\newcommand*{\XOA@@@@xnewcommand}{}
+\newcommand*{\XOA@@@@ynewcommand}{}
+\newcommand*{\XOA@@@ynewcommand}{}
+
+% [<prefix-def>] {<command>}
+%% \long \def \XOA@xnewcommand [#1]#2{%
+%% \@testopt {\XOA@@xnewcommand{#1}{#2}}{0}%
+%% }
+
+% {<command>}
+\long \def \XOA@xnewcommand #1{\@testopt {\XOA@@xnewcommand{#1}}{0}}
+
+% {<prefix-def>} {<command>} [<arg-num>]
+%% \long \def \XOA@@xnewcommand #1#2[#3]{%
+%% \ifnum #3>0
+%% \expandafter \@firstoftwo
+%% \else
+%% \expandafter \@secondoftwo
+%% \fi
+%% {\XOA@@@xnewcommand{#1}{#2}{#3}}% Possibly with optional
+%% {\XOA@@@ynewcommand{#1}{#2}}% Certainly without optional
+%% }
+
+% {<command>} [<arg-num>]
+\long \def \XOA@@xnewcommand #1[#2]{%
+ \ifnum #2>0
+ \expandafter \@firstoftwo
+ \else
+ \expandafter \@secondoftwo
+ \fi
+ {\XOA@@@xnewcommand{#1}{#2}}% Possibly with optional
+ {\XOA@@@ynewcommand{#1}}% Certainly without optional
+}
+
+
+% {<prefix-def>} {<command>} {<arg-num>}
+%% \long \def \XOA@@@xnewcommand #1#2#3{%
+%% \@ifnextchar [%]
+%% {\XOA@@@@xnewcommand{#1}{#2}{#3}}% With optional
+%% {\XOA@@@@ynewcommand{#1}{#2}{#3}}% Without optional
+%% }
+
+% {<command>} {<arg-num>}
+\long \def \XOA@@@xnewcommand #1#2{%
+ \@ifnextchar [%]
+ {\XOA@@@@xnewcommand{#1}{#2}}% With optional
+ {\XOA@@@@ynewcommand{#1}{#2}}% Without optional
+}
+
+% {<prefix-def>} {<command>} {<arg-num>} [<default>] {<definition>}
+%% \long \def \XOA@@@@xnewcommand #1#2#3[#4]#5{%
+%% \ifnum #3<2
+%% \PackageWarning{xoptarg}{%
+%% Without at least one mandatory argument {...}\MessageBreak
+%% I cannot make the macro \protect#2\space expandible.\MessageBreak
+%% I will make it robust instead%
+%% }%
+%% \def \@tempa ##1{%
+%% \in@{\protected}{#1}%
+%% \unless \ifin@
+%% \XOA@protected
+%% \fi
+%% #1#2{\@testopt {##1}{#4}}%
+%% \def \@tempa {#1##1}%
+%% \def \@tempb ####1#3####2\@nil {####1#3}%
+%% \expandafter \@tempa \@tempb [####1]%
+%% ####2####3####4####5####6####7####8####9\@nil
+%% }%
+%% \count@ = \escapechar
+%% \escapechar = -1
+%% \expandafter \@tempa \csname \string #2 \endcsname {#5}%
+%% \escapechar = \count@
+%% \else
+%% \def \@tempa ##1{%
+%% #1#2####1####{%
+%% \XOA@ifempty{####1}%
+%% {##1[{#4}]}%
+%% {%
+%% \XOA@ifbeginswithspace{####1}%
+%% {\XOA@removespace \foo ####1}%
+%% {\XOA@ifbracket {##1[}{##1[{#4}]}####1}%]
+%% }%
+%% }%
+%% \def \@tempa {#1##1}%
+%% \def \@tempb ####1#3####2\@nil {####1#3}%
+%% \expandafter \@tempa \@tempb [####1]%
+%% ####2####3####4####5####6####7####8####9\@nil
+%% }%
+%% \count@ = \escapechar
+%% \escapechar = -1
+%% \expandafter \@tempa \csname \string #2 \endcsname {#5}%
+%% \escapechar = \count@
+%% \fi
+%% }
+
+% {<command>} {<arg-num>} [<default>] {<definition>}
+\long \def \XOA@@@@xnewcommand #1#2[#3]#4{%
+ \ifnum #2<2
+ \PackageWarning{xoptarg}{%
+ Without at least one mandatory argument {...}\MessageBreak
+ I cannot make the macro \protect#1\space expandible.\MessageBreak
+ I will make it robust instead%
+ }%
+ \def \@tempa ##1{%
+ \expandafter \in@ \expandafter \protected \expandafter {\l@ngrel@x}%
+ \unless \ifin@
+ \XOA@protected
+ \fi
+ \l@ngrel@x \def #1{\@testopt {##1}{#3}}%
+ \def \@tempa {\l@ngrel@x \def ##1}%
+ \def \@tempb ####1#2####2\@nil {####1#2}%
+ \expandafter \@tempa \@tempb [####1]%
+ ####2####3####4####5####6####7####8####9\@nil
+ }%
+ \count@ = \escapechar
+ \escapechar = -1
+ \expandafter \@tempa \csname \string #1 \endcsname {#4}%
+ \escapechar = \count@
+ \else
+ \def \@tempa ##1{%
+ \l@ngrel@x \def #1####1####{%
+ \XOA@ifempty{####1}%
+ {##1[{#3}]}%
+ {%
+ \XOA@ifbeginswithspace{####1}%
+ {\XOA@removespace \foo ####1}%
+ {\XOA@ifbracket {##1[}{##1[{#3}]}####1}%]
+ }%
+ }%
+ \def \@tempa {\l@ngrel@x \def ##1}%
+ \def \@tempb ####1#2####2\@nil {####1#2}%
+ \expandafter \@tempa \@tempb [####1]%
+ ####2####3####4####5####6####7####8####9\@nil
+ }%
+ \count@ = \escapechar
+ \escapechar = -1
+ \expandafter \@tempa \csname \string #1 \endcsname {#4}%
+ \escapechar = \count@
+ \fi
+}
+
+% {<prefix-def>} {<command>} {<arg-num>} {<definition>}
+%% \long \def \XOA@@@@ynewcommand #1#2#3#4{%
+%% \def \@tempa {#1#2}%
+%% \def \@tempb ##1#3##2\@nil {##1#3}%
+%% \expandafter \@tempa \@tempb ##1##2##3##4##5##6##7##8##9\@nil {#4}%
+%% }
+
+% {<command>} {<arg-num>} {<definition>}
+\long \def \XOA@@@@ynewcommand #1#2#3{%
+ \def \@tempa {\l@ngrel@x \def #1}%
+ \def \@tempb ##1#2##2\@nil {##1#2}%
+ \expandafter \@tempa \@tempb ##1##2##3##4##5##6##7##8##9\@nil {#3}%
+}
+
+% {<prefix-def>} {<command>} {<definition>}
+%% \long \def \XOA@@@ynewcommand #1#2#3{#1#2{#3}}
+
+% {<command>} {<definition>}
+\long \def \XOA@@@ynewcommand #1#2{\l@ngrel@x \def #1{#2}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand*{\XOA@ifbeginswithspace}[1]{%
+ \XOA@@ifbeginswithspace #1 \@nil
+}
+
+\newcommand*{\XOA@@ifbeginswithspace}{}
+\def \XOA@@ifbeginswithspace #1 #2\@nil {%
+ \XOA@ifempty{#1}%
+ {\@firstoftwo}%
+ {\@secondoftwo}%
+}
+
+\newcommand*{\XOA@removespace}{}
+\def \XOA@removespace #1 {#1}
+
+\newcommand*{\XOA@ifbracket}[3]{%
+ \ifx [#3%
+ \expandafter \@firstoftwo
+ \else
+ \expandafter \@secondoftwo
+ \fi
+ {#1}{#2#3}%
+}
+
+\newcommand*{\XOA@ifempty}[1]{%
+ \ifx \relax #1\relax
+ \expandafter \@firstoftwo
+ \else
+ \expandafter \@secondoftwo
+ \fi
+}
+
+\empty
diff --git a/Master/texmf-dist/tpm/xoptarg.tpm b/Master/texmf-dist/tpm/xoptarg.tpm
new file mode 100644
index 00000000000..86f1438cad3
--- /dev/null
+++ b/Master/texmf-dist/tpm/xoptarg.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/xoptarg.zip">
+ <TPM:Name>xoptarg</TPM:Name>
+ <TPM:Type>Package</TPM:Type>
+ <TPM:Date>2007/04/22 09:24:00</TPM:Date>
+ <TPM:Version></TPM:Version>
+ <TPM:Creator>karl</TPM:Creator>
+ <TPM:Title>The xoptarg package.</TPM:Title>
+ <TPM:Description></TPM:Description>
+ <TPM:Author></TPM:Author>
+ <TPM:Size>395627</TPM:Size>
+ <TPM:License></TPM:License>
+ <TPM:Build/>
+ <TPM:RunFiles size="7429">
+texmf-dist/tex/latex/xoptarg/xoptarg.sty
+texmf-dist/tpm/xoptarg.tpm
+ </TPM:RunFiles>
+ <TPM:DocFiles size="389145">
+texmf-dist/doc/latex/xoptarg/README
+texmf-dist/doc/latex/xoptarg/xoptarg.pdf
+texmf-dist/doc/latex/xoptarg/xoptarg.tex
+ </TPM:DocFiles>
+ <TPM:Provides>Package/xoptarg</TPM:Provides>
+ </rdf:Description>
+</rdf:RDF>
+
diff --git a/Master/texmf/lists/xoptarg b/Master/texmf/lists/xoptarg
new file mode 100644
index 00000000000..19b949a0e04
--- /dev/null
+++ b/Master/texmf/lists/xoptarg
@@ -0,0 +1,8 @@
+texmf-dist/doc/latex/xoptarg/README
+texmf-dist/doc/latex/xoptarg/xoptarg.pdf
+texmf-dist/doc/latex/xoptarg/xoptarg.tex
+
+texmf-dist/tex/latex/xoptarg/xoptarg.sty
+texmf-dist/tpm/xoptarg.tpm
+
+texmf/lists/xoptarg
diff --git a/Master/texmf/tpm/collection-latexextra.tpm b/Master/texmf/tpm/collection-latexextra.tpm
index 89861b12bf8..afc4ce6b6d2 100644
--- a/Master/texmf/tpm/collection-latexextra.tpm
+++ b/Master/texmf/tpm/collection-latexextra.tpm
@@ -526,6 +526,7 @@ A large collection of add-on packages for LaTeX.
<TPM:Package name="xifthen"/>
<TPM:Package name="xmpincl"/>
<TPM:Package name="xnewcommand"/>
+ <TPM:Package name="xoptarg"/>
<TPM:Package name="xytree"/>
<TPM:Package name="yafoot"/>
<TPM:Package name="yplan"/>