diff options
author | Karl Berry <karl@freefriends.org> | 2012-03-03 01:34:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-03-03 01:34:16 +0000 |
commit | 1a7bb70572d407edc8d0f3997c285349baf222d3 (patch) | |
tree | 00b325fd96b09f9bb5f9d82848ac25d5d7eebfcc /Master/texmf-dist/tex/latex | |
parent | 22ce6570c6b6a89d849207b49c0ff9ad7ecad9d5 (diff) |
lmake 1.0 (1mar12)
git-svn-id: svn://tug.org/texlive/trunk@25552 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/lmake/lmake.sty | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/lmake/lmake.sty b/Master/texmf-dist/tex/latex/lmake/lmake.sty new file mode 100644 index 00000000000..50a4c761268 --- /dev/null +++ b/Master/texmf-dist/tex/latex/lmake/lmake.sty @@ -0,0 +1,147 @@ +%% +%% This is file `lmake.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% lmake.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2012 by Shengjun Pan <panshengjun@gmail.com> +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.2 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 +%% +%% and version 1.2 or later is part of all distributions of LaTeX version +%% 1999/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{lmake} + [2012/02/29 v1.0 .dtx lmake file] +\newif\ifL@Equal +\def\L@Compare#1#2{% + \protected@edef\L@a{#1}\protected@edef\L@b{#2}% + \ifx\L@a\L@b\L@Equaltrue\else\L@Equalfalse\fi} +\def\L@FuzzyCompare#1#2{% + \L@Compare{#1}{#2}\ifL@Equal\else\L@Compare{#1}{ #2}\fi} +\def\L@SoftCompare#1#2{% + \def\L@a{#1}\def\L@b{#2}% + \ifx\L@a\L@b\L@Equaltrue\else\L@Equalfalse\fi} +\def\L@FuzzySoftCompare#1#2{% + \L@SoftCompare{#1}{#2}\ifL@Equal\else\L@SoftCompare{#1}{ #2}\fi} +\def\L@Ignore#1\end{} +\newif\ifL@HasEqualSign +\def\L@HasEqualSign#1{% + \L@HasEqualSignfalse\L@HES#1\end} +\def\L@HES#1{% + \ifx#1=\L@HasEqualSigntrue\let\L@Next=\L@Ignore% + \else\ifx#1\end\let\L@Next=\relax\else\let\L@Next=\L@HES\fi% + \fi\L@Next} +\def\L@ArName[#1]{\ifcase#1 L@Pattern\or L@Comma\or L@Last\or% +L@First\or L@Second\or L@Dots\or L@List\else L@Other\fi} +\def\L@Set[#1]=#2;{\global\expandafter\let\csname\L@ArName[#1]\endcsname=#2} +\def\L@Get[#1]{\csname\L@ArName[#1]\endcsname} +\@ifpackageloaded{amsmath} + {\def\L@Ldots{\dotsc}\def\L@Cdots{\dotsb}} + {\def\L@Ldots{\ldots}\def\L@Cdots{\cdots}} +\newif\ifL@Start +\def\L@Map#1#2#3{% + \def\L@Sym{\empty}\def\LM@Func{#1}\def\L@Sep{#3}% + \L@Starttrue\expandafter\L@Iterate#2,\end} +\def\L@Iterate#1,#2{% + \LM@Func{#1}% + \ifx#2\end\let\L@Next=\relax\def\L@Nextarg{\empty}% + \else\L@Sep\let\L@Next=\L@Iterate\def\L@Nextarg{#2}\fi% + \expandafter\L@Next\L@Nextarg} +\def\L@GetKeyValue#1{% + \def\L@Key{}\def\L@Value{}\L@HasEqualSign{#1}% + \ifL@HasEqualSign\L@GetKV#1\end% + \else\def\L@Key{}\def\L@Value{#1}% + \fi} +\def\L@GetKV#1=#2\end{% + \def\L@Key{#1}\def\L@Value{#2}} +\newcount\L@idx +\def\L@Parse#1{\L@idx=0% + \L@FuzzySoftCompare{#1}{}% + \ifL@Equal\else\def\L@Extra{}\L@PRS#1,\end,\fi} +\def\L@PRS#1,{% + \L@SoftCompare{#1}{\end}\ifL@Equal% + \let\L@Next=\relax% + \else% + \L@FuzzySoftCompare{#1}{}\ifL@Equal% + \ifnum\L@idx<7% + \ifcase\the\L@idx% + \def\L@Default{\i}% + \or\def\L@Default{,}% + \or\def\L@Default{n}% + \or\def\L@Default{1}% + \or\def\L@Default{2}% + \or\def\L@Default{}% + \or\def\L@Default{}% + \fi% + \L@Set[\the\L@idx]=\L@Default;% + \advance \L@idx by 1% + \fi% + \else% + \L@GetKeyValue{#1}\let\L@CV=\L@Value% + \L@FuzzyCompare{\L@Key}{p}\ifL@Equal\L@idx=1\L@Set[0]=\L@CV;% + \else\L@FuzzyCompare{\L@Key}{c}\ifL@Equal\L@idx=2\L@Set[1]=\L@CV;% + \else\L@FuzzyCompare{\L@Key}{n}\ifL@Equal\L@idx=3\L@Set[2]=\L@CV;% + \else\L@FuzzyCompare{\L@Key}{1}\ifL@Equal\L@idx=4\L@Set[3]=\L@CV;% + \else\L@FuzzyCompare{\L@Key}{2}\ifL@Equal\L@idx=5\L@Set[4]=\L@CV;% + \else\L@FuzzyCompare{\L@Key}{d}\ifL@Equal\L@idx=6\L@Set[5]=\L@CV;% + \else\L@FuzzyCompare{\L@Key}{l}\ifL@Equal\L@idx=7\L@Set[6]=\L@CV;% + \else\L@FuzzyCompare{\L@Key}{}\ifL@Equal% + \ifnum\L@idx<7% + \L@Set[\the\L@idx]=\L@CV;% + \fi% + \advance \L@idx by 1% + \fi\fi\fi\fi\fi\fi\fi\fi\fi% + \let\L@Next=\L@PRS% + \fi% + \L@Next} +\newif\ifL@FoundFirst +\newcommand{\lmake}[1][]{% +\begingroup% + \L@Parse{p=\i,c={,},d=,1=1,2=2,n=n,l=}% + \L@Parse{#1}% + \def\L@Func##1{\def\i{##1}\L@Get[0]}% + \L@Compare{\L@Dots}{\empty}\ifL@Equal% + \L@Compare{\L@Comma}{,}\ifL@Equal% + \def\L@Dots{\L@Ldots}\else\def\L@Dots{\L@Cdots}% + \fi + \fi + \L@Compare{\L@List}{\empty}\ifL@Equal% + \L@FoundFirstfalse% + \L@Compare{\L@First}{\empty}\ifL@Equal\else% + \L@Func{\L@First}\L@FoundFirsttrue% + \fi% + \L@Compare{\L@Second}{\empty}\ifL@Equal\else% + \ifL@FoundFirst\L@Comma\fi% + \L@Func{\L@Second}\L@FoundFirsttrue% + \fi% + \L@Compare{\L@Dots}{\empty}\ifL@Equal\else% + \ifL@FoundFirst\L@Comma\fi\L@Dots% + \fi% + \L@Compare{\L@Last}{\empty}\ifL@Equal\else% + \L@Comma\L@Func{\L@Last}% + \fi% + \else% + \L@Map{\L@Func}{\L@List}{\L@Comma}% + \fi% +\endgroup} +\def\L@CmdName#1{% + \if\noexpand#1\noexpand\L@anycmd\expandafter\L@StripFirst\string#1\else#1\fi} +\def\L@StripFirst#1#2{#2} +\def\lcmd#1#2#3{% + \def\L@MakeCmd##1{% + \expandafter\def\csname #2\L@CmdName##1\endcsname{#1{##1}}}% + \L@Map{\L@MakeCmd}{#3}{}} +\endinput +%% +%% End of file `lmake.sty'. |