diff options
author | Karl Berry <karl@freefriends.org> | 2007-08-17 00:39:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-08-17 00:39:27 +0000 |
commit | 9b2db6d4800d0edf3e03f9ebff38c3e4ecada25b (patch) | |
tree | 2c87e62e3cc16d9b59faf3c9949c4d6efd21991d /Master/texmf-dist | |
parent | 6882d3e9a8919f0ca16e0819528b15ff31775c78 (diff) |
xfor 1.02
git-svn-id: svn://tug.org/texlive/trunk@4750 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/xfor/CHANGES | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xfor/README | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xfor/xfor.pdf | bin | 98540 -> 108442 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/xfor/xfor.dtx | 73 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/xfor/xfor.ins | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xfor/xfor.sty | 10 |
6 files changed, 79 insertions, 17 deletions
diff --git a/Master/texmf-dist/doc/latex/xfor/CHANGES b/Master/texmf-dist/doc/latex/xfor/CHANGES index ee425c46e51..f0af3f9af82 100644 --- a/Master/texmf-dist/doc/latex/xfor/CHANGES +++ b/Master/texmf-dist/doc/latex/xfor/CHANGES @@ -1,5 +1,8 @@ xfor change log: +v1.02 (16 August 2007): + added look ahead facility + v1.01 (11 July 2007): made \@iforgatherrest and \@forgatherrest \long diff --git a/Master/texmf-dist/doc/latex/xfor/README b/Master/texmf-dist/doc/latex/xfor/README index abfd12dec02..fe86d45f2cd 100644 --- a/Master/texmf-dist/doc/latex/xfor/README +++ b/Master/texmf-dist/doc/latex/xfor/README @@ -1,11 +1,13 @@ LaTeX Package : xfor -Last Modified : 11 July 2009 -Version : 1.01 +Last Modified : 16 August 2007 +Version : 1.02 Author : Nicola Talbot This package redefines \@for so that it is possible to -prematurely terminate the loop. +prematurely terminate the loop. There is also a look ahead +facility to access the next element before moving on to the +next iteration. The package is supplied using the TeX Directory Structure (TDS). Files in texmf directory should go in the corresponding diff --git a/Master/texmf-dist/doc/latex/xfor/xfor.pdf b/Master/texmf-dist/doc/latex/xfor/xfor.pdf Binary files differindex dec39f6f722..385b0419dc1 100644 --- a/Master/texmf-dist/doc/latex/xfor/xfor.pdf +++ b/Master/texmf-dist/doc/latex/xfor/xfor.pdf diff --git a/Master/texmf-dist/source/latex/xfor/xfor.dtx b/Master/texmf-dist/source/latex/xfor/xfor.dtx index 863efb923cc..eda8dbe5802 100644 --- a/Master/texmf-dist/source/latex/xfor/xfor.dtx +++ b/Master/texmf-dist/source/latex/xfor/xfor.dtx @@ -1,12 +1,12 @@ %\iffalse -% xfor.dtx generated using makedtx version 0.91b (c) Nicola Talbot +% xfor.dtx generated using makedtx version 0.93b (c) Nicola Talbot % Command line args: % -src "xfor.sty=>xfor.sty" % -doc "manual.tex" % -author "Nicola Talbot" % -dir "source" % xfor -% Created on 2007/7/11 12:25 +% Created on 2007/8/16 15:55 %\fi %\iffalse %<*package> @@ -34,6 +34,7 @@ % \iffalse %<*driver> \documentclass[a4paper]{ltxdoc} +\usepackage{xfor} \usepackage{ifthen} \usepackage{alltt} \usepackage[colorlinks, @@ -43,7 +44,7 @@ pdftitle={xfor: redefinition of '@for}, pdfkeywords={LaTeX,package development}]{hyperref} -\CheckSum{104} +\CheckSum{117} \PageIndex \RecordChanges \newcommand*{\sty}[1]{\textsf{#1}} @@ -55,7 +56,7 @@ %\fi %\MakeShortVerb{"} % -% \title{xfor v1.01: Reimplementation of \cs{@for} to allow +% \title{xfor v1.02: Reimplementation of \cs{@for} to allow %premature termination of the loop} % \author{Nicola L.C. Talbot\\[10pt] %School of Computing Sciences\\ @@ -64,7 +65,7 @@ %NR4 7TJ. United Kingdom.\\ %\url{http://theoval.cmp.uea.ac.uk/~nlct/}} % -%\date{11th July 2007} +%\date{16th August 2007} %\maketitle %\tableofcontents % @@ -90,6 +91,19 @@ %whether the loop was prematurely terminated using the conditional %\DescribeMacro{\if@endfor}\cs{if@endfor}. % +%As from version 1.02, there is also provision for looking ahead. +%At each iteration in the loop, the next element is stored in +%\cs{@xfor@nextelement}\DescribeMacro{\@xfor@nextelement}. +%On the last iteration, this value +%will be \cs{@nil}, and so can be checked using +%\begin{verbatim} +%\ifx\@xfor@nextelement\@nnil +%% last iteration +%\else +%% not last iteration +%\fi +%\end{verbatim} +% %\subsection{Example (ordered insertion)} % %Suppose you have list of sorted numbers stored in the command @@ -199,9 +213,30 @@ %\end{verbatim} %at the end of the definition of \cs{insertinto} will fix that. % -%\changes{1.0}{2007 June 27}{Initial version} +%\subsection{Example (looking ahead)} % -% \StopEventually{\phantomsection\addcontentsline{toc}{section}{Index}\PrintIndex} +%This example checks the next value to determine if the loop +%is on the last iteration, if it is, it does nothing, otherwise +%it does a semi-colon: +%\begin{verbatim} +%\makeatletter +%\def\mylist{1,2,3,4,5}% +%\@for\val:=\mylist\do{\val +%\ifx\@xfor@nextelement\@nnil \else ;\fi} +%\makeatother +%\end{verbatim} +%which produces: +%\makeatletter +%\def\mylist{1,2,3,4,5}\relax +%\@for\val:=\mylist\do{\val +%\ifx\@xfor@nextelement\@nnil \else ;\fi} +%\makeatother +% +% \StopEventually{\clearpage\phantomsection +%\addcontentsline{toc}{section}{Change History} +%\PrintChanges\phantomsection +%\addcontentsline{toc}{section}{Index} +%\PrintIndex} % % % @@ -214,7 +249,7 @@ % Declare package: % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{xfor}[2007/07/11 v1.01 (NLCT)] +\ProvidesPackage{xfor}[2007/08/16 v1.02 (NLCT)] % \end{macrocode} % Define a switch to determine if the for loop should be % terminated: @@ -251,6 +286,7 @@ \def#4{#1}% \ifx#4\@nnil \else + \@xfor@storenext#2,#3\@@% #5% \if@endfor \@iforgatherrest#2,#3% @@ -258,6 +294,7 @@ \def#4{#2}% \ifx#4\@nnil \else + \@xfor@storenext#3,\@nil\@@% #5% \if@endfor \@iforgatherrest#3% @@ -270,16 +307,27 @@ } % \end{macrocode} %\end{macro} -% Get remainder of list (stores in \cs{@forremainder}): -%\changes{1.01}{2007 July 11}{Made '@forgatherrest long}% +%\changes{1.02}{2007 August 16}{Added \cs{@xfor@storenext}}% +%\begin{macro}{\@xfor@storenext} +% Stores first argument in \cs{@xfor@nextelement}. +% \begin{macrocode} +\def\@xfor@storenext#1,#2\@@{% +\def\@xfor@nextelement{#1}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@forgatherrest} +% Get remainder of list (stores in \cs{@forremainder}): +%\changes{1.01}{2007 July 11}{made long}% % \begin{macrocode} \long\def\@forgatherrest#1,\@nil,\@nil{\def\@forremainder{#1}} % \end{macrocode} %\end{macro} -% As above, but there may not be anything before \cs{@nil}: -%\changes{1.01}{2007 July 11}{Made '@iforgatherrest long}% +% %\begin{macro}{\@iforgatherrest} +% As above, but there may not be anything before \cs{@nil}: +%\changes{1.01}{2007 July 11}{made long}% % \begin{macrocode} \long\def\@iforgatherrest#1\@nil,\@nil{% \def\@fortmp{#1}% @@ -299,6 +347,7 @@ \ifx#3\@nnil \let\@ifornext\@fornoop \else + \@xfor@storenext#2,\@nil\@@% #4\relax \if@endfor \@iforgatherrest#2\relax diff --git a/Master/texmf-dist/source/latex/xfor/xfor.ins b/Master/texmf-dist/source/latex/xfor/xfor.ins index 225a78fb744..45caba065e3 100644 --- a/Master/texmf-dist/source/latex/xfor/xfor.ins +++ b/Master/texmf-dist/source/latex/xfor/xfor.ins @@ -1,4 +1,4 @@ -% xfor.ins generated using makedtx version 0.91b 2007/7/11 12:25 +% xfor.ins generated using makedtx version 0.93b 2007/8/16 15:55 \input docstrip \preamble diff --git a/Master/texmf-dist/tex/latex/xfor/xfor.sty b/Master/texmf-dist/tex/latex/xfor/xfor.sty index b1992383595..77a81d5fe86 100644 --- a/Master/texmf-dist/tex/latex/xfor/xfor.sty +++ b/Master/texmf-dist/tex/latex/xfor/xfor.sty @@ -26,12 +26,14 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} +%% last iteration +%% not last iteration %% store new list in \toks@ %% test current value against new value %% append new stuff to new list %% check to see if for loop was prematurely terminated \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{xfor}[2007/07/11 v1.01 (NLCT)] +\ProvidesPackage{xfor}[2007/08/16 v1.02 (NLCT)] \newif\if@endfor \long\def\@for#1:=#2\do#3{% \@endforfalse @@ -47,6 +49,7 @@ \def#4{#1}% \ifx#4\@nnil \else + \@xfor@storenext#2,#3\@@% #5% \if@endfor \@iforgatherrest#2,#3% @@ -54,6 +57,7 @@ \def#4{#2}% \ifx#4\@nnil \else + \@xfor@storenext#3,\@nil\@@% #5% \if@endfor \@iforgatherrest#3% @@ -64,6 +68,9 @@ \fi \fi } +\def\@xfor@storenext#1,#2\@@{% +\def\@xfor@nextelement{#1}% +} \long\def\@forgatherrest#1,\@nil,\@nil{\def\@forremainder{#1}} \long\def\@iforgatherrest#1\@nil,\@nil{% \def\@fortmp{#1}% @@ -78,6 +85,7 @@ \ifx#3\@nnil \let\@ifornext\@fornoop \else + \@xfor@storenext#2,\@nil\@@% #4\relax \if@endfor \@iforgatherrest#2\relax |