diff options
author | Karl Berry <karl@freefriends.org> | 2009-07-19 18:13:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-07-19 18:13:59 +0000 |
commit | 97ea53ff09cc961846648bbba9f2acc716cf8015 (patch) | |
tree | 5526f85cb061b27e8b31dad6fc45889cddb6ec70 /Master/texmf-dist/tex/latex/etextools/etextools.sty | |
parent | a242529bcf517df9bcf227f4636fd56c5072ecf7 (diff) |
new package etextools (16jul09)
git-svn-id: svn://tug.org/texlive/trunk@14320 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/etextools/etextools.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/etextools/etextools.sty | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/etextools/etextools.sty b/Master/texmf-dist/tex/latex/etextools/etextools.sty new file mode 100644 index 00000000000..93f0792044b --- /dev/null +++ b/Master/texmf-dist/tex/latex/etextools/etextools.sty @@ -0,0 +1,141 @@ +%% +%% This is file `etextools.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% etextools.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2009 by Florent Chervet <florent.chervet@free.fr> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% +%% This work consists of the main source file etextools.dtx +%% and the derived files +%% etextools.sty, etextools.pdf, etextools.ins, +%% +%%% etextools : more e-TeX useful tools for LaTeX package writers +%%% Florent CHERVET +\NeedsTeXFormat{LaTeX2e}[1996/12/01] +\ProvidesPackage{etextools} + [2009/07/14 v2e e-TeX more useful tools for LaTeX package writers] +\csname ettl@onlyonce\endcsname\let\ettl@onlyonce\endinput +\RequirePackage{etex,etoolbox} +\edef\ettl@restore@space@catcode{\catcode`\ =\the\catcode`\ } +\AtEndOfPackage{\ettl@restore@space@catcode + \let\ettl@restore@space@catcode\ettl@undefined} +\catcode`\ =10 +\long\def\ettl@afterelse#1\else#2\fi{\fi#1} +\long\def\ettl@afterfi#1\fi{\fi#1} +\newcommand*\@gobblescape{\expandafter\@gobble\string} +\newcommand\str@gobblescape[1]{\expandafter\deblank\expandafter{% + \expandafter\@gobble\detokenize{#1}}} + +\newcommand*\noexpandcs[1]{\expandafter\noexpand\csname #1\endcsname} +\newcommand\noexpandafter{\noexpand\expandafter} +\newcommand\expandnext[2]{% + \ifx#1\expandnext + \ettl@afterelse\expandafter\expandafter\expandafter + \expandafter\@expandnext{#2}{\expandafter\expandafter\expandafter} + \else\ettl@afterfi\expandafter#1\expandafter{#2} + \fi} +\long\def\@expandnext#1#2#3{% + \ifx#1\expandnext + \expandafter\ettl@afterelse\expandafter\expandafter\expandafter + \expandafter\@expandnext{#3}{\expandafter#2#2} + \else + \expandafter\ettl@afterfi#2#1#2{#3} + \fi} +\newcommand\deblank{} +\begingroup\catcode`\&=3% a & as a math shift +\long\gdef\deblank#1{\@deblank#1 &} +\long\gdef\@deblank#1 #2&{\ifblank{#2}{#1}{#1\@deblank#2 &}} +\endgroup +\newrobustcmd\xifblank[1]{\begingroup + \protected@edef\@xifblank{\endgroup + \noexpand\ifblank{#1}% + }\@xifblank} +\newrobustcmd\xifstrequal[2]{% + \begingroup\protected@edef\@tempa{#1}\protected@edef\@tempb{#2}% + \ifx\@tempa\@tempb \aftergroup\@firstoftwo + \else \aftergroup\@secondoftwo + \fi\endgroup} +\newcommand\iffirstchar[2]{% + \if \expandafter\@car\string#2\relax\@nil\expandafter\@car#1\string\\\@nil + \ettl@afterelse\ifblank{#2}\@secondoftwo\@firstoftwo + \else \expandafter\@secondoftwo + \fi} +\newcommand\ifsinglechar[2]{% + \expandnext\expandnext\ifblank{\expandafter\@cdr\string#2 \@nil} + {\iffirstchar{#1}{#2}} + \@secondoftwo} +\newcommand\FE@testopt[3]{\ifsinglechar [{#1}{#2#1}{#2[{#3}]{#1}}} +\newcommand\FE@ifstar[3]{\ifsinglechar *{#1}{#2}{#3{#1}}} +\newrobustcmd*\DeclareCmdListParser[2]{% + \@ifdefinable#1 + {\expandafter\etextools@defcmdparser\expandafter{#1}{#2}}} +\begingroup\catcode`\&=3 +\gdef\etextools@defcmdparser#1#2{% + \begingroup + \protected@edef\defineparser{\endgroup + \long\def#1####1{\noexpand\FE@ifstar{####1} + {\noexpandcs{ettl@lst@star\string#1}} + {\noexpandcs{ettl@lst@nost\string#1}}}% + \long\csdef{ettl@lst@star\string#1}####1{\noexpand\FE@testopt{####1} + {\noexpandcs{ettl@lst@star@pt\string#1}}{\noexpand\do}}% + \long\csdef{ettl@lst@nost\string#1}####1{\noexpand\FE@testopt{####1} + {\noexpandcs{ettl@lst@nost@pt\string#1}}{\noexpand\do}}% + \long\csdef{ettl@lst@star@pt\string#1}[####1]####2{% + \noexpandcs{ettl@lst\string#1}{####2}{####1}}% + \long\csdef{ettl@lst@nost@pt\string#1}[####1]####2{% + \noexpandafter\noexpandcs{ettl@lst\string#1}\noexpandafter{% + ####2}{####1}}% + \long\csdef{ettl@lst\string#1}####1####2{% + \noexpandcs{ettl@lst@\string#1}{####2}####1\noexpand#2&}% + \long\csdef{ettl@lst@\string#1}####1####2\noexpand#2####3&{% + \noexpand\ifblank{####2} + {} + {\noexpand\ettl@lst@doitem{####1}{####2}}% + \noexpand\ifblank{####3} + {\noexpand\ettl@listbreak} + {\noexpandcs{ettl@lst@\string#1}{####1}####3}&}% + }\defineparser}% + \long\gdef\ettl@lst@doitem#1#2{#1{#2}}% + \long\gdef\ettl@listbreak#1&{}% +\endgroup +\DeclareCmdListParser\csvloop{,} +\begingroup\catcode`\|=3 + \gdef\do{\DeclareCmdListParser\listloop{|}\undef\do}\aftergroup\do +\endgroup +\newcommand\csvtolist[1]{\FE@ifstar{#1}\star@csvtolist\nost@csvtolist} +\def\star@csvtolist#1{\csvloop*[{\unexpanded{\listadd#1}}]} +\def\nost@csvtolist#1{\csvloop[{\unexpanded{\listadd#1}}]} +\newrobustcmd\listdel[2]{\@listdel\def{#1}{#2}} +\newrobustcmd\listgdel[2]{\@listdel\gdef{#2}{#2}} +\newrobustcmd\listxdel[2]{\begingroup + \protected@edef\@listxdel{\endgroup + \unexpanded{\@listdel\def#1}{#2}% + }\@listxdel} + \begingroup\catcode`\|=3\catcode`\&=3 + \long\gdef\@listdel#1#2#3{% + \begingroup + \def\@tempa##1|#3|##2&{##1|##2\@tempb}% + \def\@tempb|##1|\@tempb##2|\@tempb{% + \ifblank{##2}{\unexpanded{##1}} + {\ifblank{##1}{}{\@tempx##1&}}}% + \def\@tempx##1&{\expandafter\@tempb\@tempa|##1|\@tempb|#3|&}% + \edef\@redef{\endgroup + \unexpanded{#1#2}{% ie: \def or \gdef \listmacro + \expandafter\@tempx\unexpanded\expandafter{#2}&}% + }\@redef}% end of \@listdel +\endgroup + +\endinput +%% +%% End of file `etextools.sty'. |