From 8b1ee5d05bc5011c081a06a50f03e97a6e4a1420 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 11 Jul 2010 01:03:38 +0000 Subject: ifmtarg update (10jul10) git-svn-id: svn://tug.org/texlive/trunk@19363 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/ifmtarg/README | 51 ++++++ Master/texmf-dist/doc/latex/ifmtarg/ifmtarg.pdf | Bin 256142 -> 170807 bytes Master/texmf-dist/doc/latex/ifmtarg/ifmtarg.tex | 107 ----------- Master/texmf-dist/source/latex/ifmtarg/ifmtarg.ins | 4 + Master/texmf-dist/source/latex/ifmtarg/ifmtarg.tex | 198 +++++++++++++++++++++ Master/texmf-dist/tex/latex/ifmtarg/ifmtarg.sty | 67 +------ 6 files changed, 257 insertions(+), 170 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/ifmtarg/README delete mode 100644 Master/texmf-dist/doc/latex/ifmtarg/ifmtarg.tex create mode 100644 Master/texmf-dist/source/latex/ifmtarg/ifmtarg.ins create mode 100644 Master/texmf-dist/source/latex/ifmtarg/ifmtarg.tex (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/ifmtarg/README b/Master/texmf-dist/doc/latex/ifmtarg/README new file mode 100644 index 00000000000..644988fcbb8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/ifmtarg/README @@ -0,0 +1,51 @@ + +The IFMTARG package +=================== + +Provides a command for the LaTeX programmer for testing +whether an argument is empty. + + +INSTALLATION +------------ + +Run `pdflatex` on ifmtarg.tex to produce the files + ifmtarg.ins and ifmtarg.sty, +as well as to compile the PDF documentation. + +Execute `tex ifmtarg.ins` to produce the files above +except ifmtarg.ins itself (and the PDF file, obviously). + + +COPYRIGHT AND LICENSING +----------------------- + +Authors: Donald Arseneau and Peter Wilson (Herries Press) +Maintainer: Will Robertson (will dot robertson at latex-project dot org) +Copyright 1996 Peter Wilson +Copyright 2000 Peter Wilson and Donald Arseneau + +This work 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: + +This work has the LPPL maintenance status "maintained". +The Current Maintainer of this work is Will Robertson. + +This work consists of the files ifmtarg.tex and the +derived files ifmtarg.sty and ifmtarg.ins. + + +MAINTENANCE +----------- + +Please report bugs or request features: + + +Developmental and historical versions: + + +Current release version: + + diff --git a/Master/texmf-dist/doc/latex/ifmtarg/ifmtarg.pdf b/Master/texmf-dist/doc/latex/ifmtarg/ifmtarg.pdf index 88dc0ae7724..1290481e9e4 100644 Binary files a/Master/texmf-dist/doc/latex/ifmtarg/ifmtarg.pdf and b/Master/texmf-dist/doc/latex/ifmtarg/ifmtarg.pdf differ diff --git a/Master/texmf-dist/doc/latex/ifmtarg/ifmtarg.tex b/Master/texmf-dist/doc/latex/ifmtarg/ifmtarg.tex deleted file mode 100644 index d86820b0653..00000000000 --- a/Master/texmf-dist/doc/latex/ifmtarg/ifmtarg.tex +++ /dev/null @@ -1,107 +0,0 @@ -\documentclass[DIV=8, parskip=half, pagesize=auto]{scrartcl} - -\usepackage{fixltx2e} -\usepackage{etex} -\usepackage{xspace} -\usepackage{lmodern} -\usepackage[T1]{fontenc} -\usepackage{textcomp} -\usepackage[svgnames]{xcolor} -\usepackage{array} -\usepackage{microtype} -\usepackage{hyperref} - -\newcommand*{\angleurl}[1]{\href{#1}{\texttt{<#1>}}} -\newcommand*{\pkg}[1]{\textsf{#1}} -\newcommand*{\cs}[1]{\texttt{\textbackslash#1}} -\makeatletter -\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}} -\makeatother -\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle} -\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}} - -\addtokomafont{title}{\rmfamily} - -\title{The \pkg{ifmtarg} package\thanks{This manual corresponds to \pkg{ifmtarg}~v1.2a, dated~2009/09/02.}} -\author{Author: Peter Wilson, Herries Press\\Maintainer: Will Robertson\thanks{will dot robertson at latex-project dot org}} -\date{2009/09/02} - - -\begin{document} - -\maketitle - -Provides an if--then--else command for an empty macro argument -(empty = zero or more spaces only) -Use as \cmd{\@ifmtarg}\marg{arg1}\marg{Code for arg1 empty}\marg{Code for arg1 not empty} - -The \cmd{\@ifmtarg} command takes 3~arguments and \cmd{\@ifnotmtarg} takes 2~arguments. -\cmd{\@ifnotmtarg} is slightly more efficient when code is only required -for a non-empty argument. - -Example usages: -% -\begin{verbatim} -\newcommand{\isempty}{1]{% - \@ifmtarg{#1}{\typeout{YES}}{\typeout{NO}}} -\end{verbatim} -% -\begin{tabular}{@{}>{\color{SeaGreen}}l@{$\quad\to\quad$}>{\ttfamily}l@{}} - \verb+\isempty{}+ & YES \\ - \verb+\isempty{ }+ & YES \\ - \verb+\isempty{E}+ & NO \\ - \verb+\isempty{ E }+ & NO -\end{tabular} -% -\begin{verbatim} -\newcommand{\isnotempty}[1]{% - \@ifnotmtarg{#1}{\typeout{YES}}} -\end{verbatim} -% -\begin{tabular}{@{}>{\color{SeaGreen}}l@{$\quad\to\quad$}>{\ttfamily}l@{}} - \verb+\isnotempty{}+ & \\ - \verb+\isnotempty{ }+ & \\ - \verb+\isnotempty{E}+ & YES \\ - \verb+\isnotempty{ E }+ & YES -\end{tabular} - -In an Email to me on 13 March 2000, Donald Arseneau pointed out some -failings with my original definition of the \cmd{\@ifmtarg} command: -% -\begin{verbatim} -\newcommand{\@ifmtarg}[3]{% - \edef\@mtarg{\zap@space#1 \@empty}% - \ifx\@empty\@mtarg\relax #2\else #3\fi} -\end{verbatim} -% -It works most of the time correctly but Donald showed that it can -give unexpected results -under conditions that I had not thought of. He suggested the coding -that now appears in the package above for the \cmd{\@ifmtarg} and -\cmd{\@ifnotmtarg} commands. For a discussion on detecting empty arguments -see \href{http://www.ctan.org/pub/tex-archive/info/aro-bend/answer.002}{\texttt{CTAN/info/aro-bend/answer.002}} - - -\minisec{Change History} - -\begin{labeling}[\hspace{\labelsep}--]{v1.2a} -\item[v1.2a] New maintainer (Will Robertson) -\end{labeling} - -\bigskip - -\begin{quote} - \footnotesize - Copyright Peter Wilson, 1996 \\ - Copyright Peter Wilson and Donald Arseneau, 2000 - - This work 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: \angleurl{http://www.latex-project.org/lppl.txt} - - This work has the LPPL maintenance status ``maintained''. - The Current Maintainer of this work is Will Robertson. -\end{quote} - -\end{document} diff --git a/Master/texmf-dist/source/latex/ifmtarg/ifmtarg.ins b/Master/texmf-dist/source/latex/ifmtarg/ifmtarg.ins new file mode 100644 index 00000000000..92b714e1535 --- /dev/null +++ b/Master/texmf-dist/source/latex/ifmtarg/ifmtarg.ins @@ -0,0 +1,4 @@ +%&latex +\def\documentationCompile{N} +\input ifmtarg.tex +\csname@@end\endcsname diff --git a/Master/texmf-dist/source/latex/ifmtarg/ifmtarg.tex b/Master/texmf-dist/source/latex/ifmtarg/ifmtarg.tex new file mode 100644 index 00000000000..29a9d6c0a2c --- /dev/null +++ b/Master/texmf-dist/source/latex/ifmtarg/ifmtarg.tex @@ -0,0 +1,198 @@ + +%%%%%%%%%1%%%%%%%%%2%%%%%%%%%3%%%%%%%%%4%%%%%%%%%5 +% Bundled source file for the IFMTARG package +%--------1---------2---------3---------4---------5 +% Please see the accompanying README for author, +% license, documentation and installation information +%%%%%%%%%1%%%%%%%%%2%%%%%%%%%3%%%%%%%%%4%%%%%%%%%5 + +\RequirePackage{filecontents} +\begin{filecontents}{ifmtarg.sty} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{ifmtarg}[2009/09/02 v1.2a check for an empty argument] +\begingroup +\catcode`\Q=3 +\long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil} +\long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4} +\long\gdef\@ifnotmtarg#1{\@xifmtarg#1QQ\@firstofone\@gobble\@nil} +\endgroup +\endinput +\end{filecontents} +%%%%%%%%%1%%%%%%%%%2%%%%%%%%%3%%%%%%%%%4%%%%%%%%%5 + + +% Conditionally compile the documentation & generate the .ins file: +\providecommand\documentationCompile{Y} +\makeatletter +\if\documentationCompile N + \expandafter\@@end +\fi + + +\begin{filecontents*}{ifmtarg.ins} +%&latex +\def\documentationCompile{N} +\input ifmtarg.tex +\csname@@end\endcsname +\end{filecontents*} + + + + +\makeatletter +\documentclass{article} + +\usepackage[it,medium]{titlesec} + +\usepackage{array,bigfoot,ifmtarg} +\usepackage[svgnames]{xcolor} +\usepackage[colorlinks,linktocpage]{hyperref} + +\usepackage{geometry} +\geometry{margin=2cm} + +\usepackage{gmdoc} +\usepackage{gmverb} +\dekclubs +\stanzaskip=\bigskipamount +\CodeSpacesGrey + +\usepackage{tocloft,varwidth} +\setcounter{tocdepth}{1} +\def\tocwidthA{0.55} +\def\tocwidthB{0.44} +\def\cftpartfont{\scshape} +\def\cftsecfont{\small} +\cftbeforesecskip=0pt +\def\cftpartleader{} +\def\cftpartafterpnum{\cftparfillskip} +\def\cftsecleader{} +\def\cftsecafterpnum{\cftparfillskip} + +\DeclareRobustCommand\pkg{\textsf} +\def\pkgopt#1{\texttt{[#1]}} +\newcommand\chng[1]{\marginpar{\footnotesize\raggedright\textsf{#1}}} + +\def\PDF{\textsc{pdf}} +\def\PS{\textsc{ps}} +\def\DVI{\textsc{dvi}} +\def\EPS{\textsc{eps}} + +\usepackage{amsmath,listings} +\lstset{basicstyle=\ttfamily,columns=fullflexible} + +\usepackage{changepage} +\usepackage[T1]{fontenc} +\usepackage{microtype} +\usepackage{lmodern} +\usepackage[sc,osf]{mathpazo} +\linespread{1.1} +\frenchspacing + +\GetFileInfo{ifmtarg.sty} +\begin{document} +{\addtocontents{toc}{\protect\begin{varwidth}[t]{\tocwidthA\linewidth}}} + +\title{The \pkg{ifmtarg} package} +\author{% + Author: Donald Arseneau, and Peter Wilson, Herries Press\\ + Maintainer: Will Robertson\\ + \texttt{will dot robertson at latex-project dot org}% +} +\date{\fileversion \qquad \filedate} + +\twocolumn[\maketitle] + +\section{Documentation} + +The \pkg{ifmtarg} package provides an if--then--else programmer's command \verb|\@ifmtarg| for testing for an empty macro argument. +`Empty' here refers to an argument of zero or more spaces only.\footnote{If you need a command to test for emptiness that doesn't include spaces, use the \verb|\tl_if_empty:nTF| conditional from the \pkg{expl3} package. \verb|\@ifmtarg| is equivalent to \pkg{expl3}'s \verb|\tl_if_blank:nTF|.} +The command is fully expandable; its syntax is: +\begin{quote} +\cmd{\@ifmtarg}\marg{arg}\marg{Code for arg empty} +\\\null\hfill +\marg{Code for arg not empty} +\end{quote} + +A variation is provided, \cmd{\@ifnotmtarg}, to be used when only the `false' branch is required. +It is slightly more efficient when code is only required for a non-empty argument. +\begin{quote} +\cmd{\@ifnotmtarg}\marg{arg}\marg{Code for arg not empty} +\end{quote} + +\section{Examples} + +\begin{verbatim} +\newcommand{\isempty}{1]{% + \@ifmtarg{#1}{YES}{NO}} +\end{verbatim} +\nobreak +\begin{tabular}{@{\hspace{1.8em}}>{\color{SeaGreen}}l@{$\quad\to\quad$}>{\ttfamily}l@{}} + \verb+\isempty{}+ & YES \\ + \verb+\isempty{ }+ & YES \\ + \verb+\isempty{E}+ & NO \\ + \verb+\isempty{ E }+ & NO +\end{tabular} + +\begin{verbatim} +\newcommand{\isnotempty}[1]{% + \@ifnotmtarg{#1}{YES}} +\end{verbatim} +\nobreak +\begin{tabular}{@{\hspace{1.8em}}>{\color{SeaGreen}}l@{$\quad\to\quad$}>{\ttfamily}l@{}} + \verb+\isnotempty{}+ & \\ + \verb+\isnotempty{ }+ & \\ + \verb+\isnotempty{E}+ & YES \\ + \verb+\isnotempty{ E }+ & YES +\end{tabular} + +\newpage +\section{History} + +(\emph{Peter's comments follow.}) In an Email to me on 13 March 2000, Donald Arseneau pointed out some +failings with my original definition of the \cmd{\@ifmtarg} command: +% +\begin{verbatim} +\newcommand{\@ifmtarg}[3]{% + \edef\@mtarg{\zap@space#1 \@empty}% + \ifx\@empty\@mtarg\relax #2\else #3\fi} +\end{verbatim} +% +It works most of the time correctly but Donald showed that it can +give unexpected results +under conditions that I had not thought of. He suggested the coding +that now appears in the package above for the \cmd{\@ifmtarg} and +\cmd{\@ifnotmtarg} commands. For a discussion on detecting empty arguments +see \href{http://www.ctan.org/pub/tex-archive/info/aro-bend/answer.002}{\texttt{CTAN/info/aro-bend/answer.002}} + + +\section*{Change History} + +\begin{itemize} +\item[v1.2a] New maintainer (Will Robertson) +\end{itemize} + + + +\section*{Licence and copyright} + +This work may be modified and/or distributed under the terms and +conditions of the \LaTeX\ Project Public License\footnote{\url{http://www.latex-project.org/lppl.txt}}, version~1.3c or later (your choice). +The current maintainer of this work is Will Robertson. + +\bigskip + \noindent + Copyright Peter Wilson, 1996 \\ + Copyright Peter Wilson and Donald Arseneau, 2000 + +{\addtocontents{toc}{\protect\end{varwidth}\protect\hfill}} +{\addtocontents{toc}{\protect\begin{varwidth}[t]{\protect\tocwidthB\protect\linewidth}}} +\clearpage +\parindent=0pt + +\section{Implementation} +\DocInput{ifmtarg.sty} + +{\addtocontents{toc}{\protect\end{varwidth}}} + +\end{document} diff --git a/Master/texmf-dist/tex/latex/ifmtarg/ifmtarg.sty b/Master/texmf-dist/tex/latex/ifmtarg/ifmtarg.sty index f34d97e828a..e6c4913d098 100644 --- a/Master/texmf-dist/tex/latex/ifmtarg/ifmtarg.sty +++ b/Master/texmf-dist/tex/latex/ifmtarg/ifmtarg.sty @@ -1,72 +1,13 @@ -% ifmtarg.sty -% -% Provides an if-then-else command for an empty macro argument -% (empty = zero or more spaces only) -% Use as \@ifmtarg{arg1}{Code for arg1 empty}{Code for arg1 not empty} -% -% Author: Peter Wilson, Herries Press -% Maintainer: Will Robertson (will dot robertson at latex-project dot org) -% Copyright Peter Wilson, 1996 -% Copyright Peter Wilson and Donald Arseneau, 2000 -% -% This work 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: -% -% This work has the LPPL maintenance status "maintained". -% The Current Maintainer of this work is Will Robertson. -% -% +%% LaTeX2e file `ifmtarg.sty' +%% generated by the `filecontents' environment +%% from source `ifmtarg' on 2010/07/10. +%% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{ifmtarg}[2009/09/02 v1.2a check for an empty argument] - -%% Commands by Donald Arseneau \begingroup \catcode`\Q=3 \long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil} \long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4} \long\gdef\@ifnotmtarg#1{\@xifmtarg#1QQ\@firstofone\@gobble\@nil} \endgroup - \endinput - -% -% The \@ifmtarg command takes 3 arguments and \@ifnotmtarg takes 2 arguments. -% \@ifnotmtarg is slightly more efficient when code is only required -% for a non-empty argument. -% -% Example usages: -% \newcommand{\isempty}{1]{% -% \@ifmtarg{#1}{\typeout{YES}}{\typeout{NO}}} -% -% \isempty{} -> YES -% \isempty{ } -> YES -% \isempty{E} -> NO -% \isempty{ E } -> NO -% -% \newcommand{\isnotempty}[1]{% -% \@ifnotmtarg{#1}{\typeout{YES}}} -% -% \isnotempty{} -> -% \isnotempty{ } -> -% \isnotempty{E} -> YES -% \isnotempty{ E } -> YES -% -% In an Email to me on 13 March 2000, Donald Arseneau pointed out some -% failings with my original definition of the \@ifmtarg command: -% \newcommand{\@ifmtarg}[3]{% -% \edef\@mtarg{\zap@space#1 \@empty}% -% \ifx\@empty\@mtarg\relax #2\else #3\fi} -% -% It works most of the time correctly but Donald showed that it can -% give unexpected results -% under conditions that I had not thought of. He suggested the coding -% that now appears in the package above for the \@ifmtarg and -% \@ifnotmtarg commands. For a discussion on detecting empty arguments -% see CTAN/info/aro-bend/answer.002 -% -% -% CHANGE HISTORY -% v1.2a - New maintainer (Will Robertson) -% -- cgit v1.2.3