diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/mlist/mlist.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/mlist/mlist.sty | 307 |
1 files changed, 307 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/mlist/mlist.sty b/Master/texmf-dist/tex/latex/mlist/mlist.sty new file mode 100644 index 00000000000..cdb83d5cfb3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/mlist/mlist.sty @@ -0,0 +1,307 @@ +%% +%% This is file `mlist.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% mlist.dtx (with options: `package') +%% mlist.dtx (with options: `defaults') +%% +%% __________________________________ +%% Copyright (C) 2006 Will Robertson +%% +%% License information appended. +%% +\ProvidesPackage{mlist} + [2007/05/19 v0.4 Typesetting maths lists] +\let\mlisthead\@firstofone +\let\mlistelem\@secondoftwo +\newcommand\mlistsub [2]{#1_{#2}} +\newcommand\mlistsup [2]{#1^{#2}} +\let\mlistnowrap\@secondoftwo +\newcommand\mlistparen[2]{\left(#2\right)} +\newcommand\mlistbrack[2]{\left[#2\right]} +\newcommand\mlistbrace[2]{\left\{#2\right\}} +\newcommand\mlistangle[2]{\left<#2\right>} +\newcommand\mlistheadparen[2]{#1\left(#2\right)} +\newcommand\mlistheadbrack[2]{#1\left[#2\right]} +\newcommand\mlistheadbrace[2]{#1\left\{#2\right\}} +\newcommand\mlistheadangle[2]{#1\left<#2\right>} +\RequirePackage{xkeyval,ifmtarg} +\unless\ifdefined\if@tempswb\newif\if@tempswb\fi +\unless\ifdefined\if@tempswc\newif\if@tempswc\fi +\unless\ifdefined\@tempcntc\newcount\@tempcntc\fi +\def\@gobblenil#1\@nil{} +\newif\if@mlist@warn +\long\def\@sfor#1:=#2\do#3{% + \expandafter\def\expandafter\@sfortmp\expandafter{#2}% + \ifx\@sfortmp\@empty\else + \expandafter\@sforloop#2;\@nil;\@nil\@@#1{#3}% + \fi} +\long\def\@sforloop#1;#2;#3\@@#4#5{% + \def#4{#1}% + \ifx #4\@nnil \else + #5% + \def#4{#2}% + \ifx #4\@nnil \else + #5% + \@siforloop #3\@@#4{#5}% + \fi + \fi} +\long\def\@siforloop#1;#2\@@#3#4{% + \def#3{#1}% + \ifx #3\@nnil + \expandafter\@fornoop + \else + #4\relax\expandafter\@siforloop + \fi + #2\@@#3{#4}} +\providecommand\let@cc[2]{% + \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname} +\providecommand\def@c[1]{% + \expandafter\def\csname#1\endcsname} +\providecommand\def@co[2]{% + \def@c{#1\expandafter}\expandafter{#2}} +\newcommand\@ifnextbrace{\expandafter\@ifnextchar\bgroup} +\def\mlist@colon{:} +\def\mlist@period{.} +\makeatother +\expandafter\def\csname mlist@ampersat\endcsname{@} +\makeatletter +\newcommand\mlistsetup[1]{\setkeys[mlist]{sym}{#1}} +\define@cmdkeys[mlist]{sym}[mlist@]{% + symbol,index,sep,sepsep,elem, + elemcmd,headcmd,dot,dots} +\define@key[mlist]{sym}{wrapcmd}{\let\mlist@wrap#1} +\define@key[mlist]{sym}{wraponecmd}[\mlist@wrap]{\let\mlist@wrapone#1} +\define@key[mlist]{sym}{wrap}{% + \def\mlist@wrap##1##2{\@firstoftwo#1##2\@secondoftwo#1}} +\define@key[mlist]{sym}{wrapone}[]{% + \ifx\relax#1\relax + \let\mlist@wrapone\mlist@wrap + \else + \def\mlist@wrapone##1##2{\@firstoftwo#1##2\@secondoftwo#1}% + \fi} +\define@key[mlist]{sym}{elem}{% + \@tempcnta\z@ + \@tempcntb\z@ + \@tempcntc\z@ + \@sfor\@jj:=#1\do{% + \advance\@tempcnta\@ne + \@tempcntb\z@ + \@tempswafalse + \@for\@ii:=\@jj\do{% + \ifx\@ii\mlist@colon + \@tempswatrue + \else + \if@tempswa + \let@cc{mlist@\the\@tempcnta @mid}{mlist@\the\@tempcnta @last}% + \def\@tempa{\def@c{mlist@\the\@tempcnta @last}}% + \expandafter\@tempa\expandafter{\@ii}% + \else + \advance\@tempcntb\@ne + \advance\@tempcntc\@ne + \def@co{mlist@\the\@tempcnta @\the\@tempcntb}{\@ii}% + \def@co{mlist@@\the\@tempcntc}{\@ii}% + \fi + \fi}% + \if@tempswa\@tempswafalse\fi}} +\define@key[mlist]{sym}{shorthand}{% + \mlist@def@shorthand#1% + \def@c{mlist@@\@tempa\expandafter}\expandafter{\@tempb}} +\def\mlist@def@shorthand#1#{% + \def\@tempa{\string#1} + \def\@tempb} +\newcommand\@mlist[1]{% + \begingroup + \let\mlist@list@elems\@empty + \@tempcnta\@ne + \mlist@count + \iffalse{\fi\ifnum0=`}\fi + \setkeys[mlist]{sym}{#1}% + \ifnum0=`{\fi\iffalse}\fi + \def\MID{\csname mlist@\the\@tempcnta @mid\endcsname}% + \def\LAST{\csname mlist@\the\@tempcnta @last\endcsname}% + \ifx\@empty\mlist@index\relax + \def\mlist@list{\mlist@headcmd{\mlist@symbol}}% + \else + \@tempcnta\z@ + \@tempswafalse + \@sfor\@jj:=\mlist@index\do{% + \let\@jj\@jj + \advance\@tempcnta\@ne + \mlist@count + \expandafter\@ifmtarg\expandafter{\@jj}{}% ignore if empty + {\if@tempswa\mlist@add\mlist@sepsep\fi + \@tempswatrue}% + \@tempcntb\z@ + \@tempswbfalse + \@for\@ii:=\@jj\do{% + \let\@ii\@ii + \advance\@tempcntb\@ne + \expandafter\@ifmtarg\expandafter{\@ii}% + {\advance\@tempcntb\m@ne + \mlist@add{\@gobble}} + {\if@tempswb\mlist@add\mlist@sep\fi + \@tempswbtrue + \ifx\@ii\mlist@colon + \mlist@add{\mlist@dots\@gobble}% + \else + \ifx\@ii\mlist@period + \mlist@add{\mlist@dot\@gobble}% + \else + \mlist@add{\mlist@elemcmd{\mlist@symbol}}% + \fi + \fi}% + \mlist@parse@implicit + \if@tempswc + \mlist@add@ifcs{% + mlist@\the\@tempcnta @\expandafter\@gobble\@ii + }{\@ii}% + \else + \mlist@add@ifcs{% + mlist@@\expandafter\detokenize\expandafter{\@ii}% + }{\@ii}% + \fi + }% + }% + \def\mlist@list{\mlist@wrap{\mlist@symbol}{\mlist@list@elems}}% + \ifnum\@tempcnta=\@ne + \ifnum\@tempcntb=\@ne + \let\mlist@wrap\mlist@wrapone + \fi + \fi + \fi + \mlist@list + \endgroup} +\newcommand\mlist@add[1]{% + \expandafter\gdef + \expandafter\mlist@list@elems + \expandafter{\mlist@list@elems#1}} +\def\mlist@count{% + \expandafter\mlist@add + \expandafter{% + \expandafter\@tempcnta\the\@tempcnta\relax}} +\newcommand\mlist@add@ifcs[2]{% + \ifcsname#1\endcsname + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi{\expandafter\mlist@add\expandafter{\expandafter{\csname#1\endcsname}}} + {\expandafter\mlist@add\expandafter{\expandafter{#2}}}} +\def\mlist@parse@implicit{% + \@tempswcfalse + \def\@tempb{% + \expandafter\@ifnextchar\mlist@ampersat + {\@tempswctrue\@gobblenil} + {\@tempswcfalse\@gobblenil}}% + \expandafter\@tempb\@ii\@nil + \unless\if@tempswc + \def\@tempb{% + \@ifnextchar @ + {\@tempswctrue\@gobblenil} + {\@tempswcfalse\@gobblenil}}% + \expandafter\@tempb\@ii\@nil + \fi} +\newcommand\newmlist[1]{% + \@mlist@warntrue + \@ifnextchar[%] + {\@defmlist@opt{#1}} + {\@defmlist@noopt{#1}}} +\newcommand\renewmlist[1]{% + \@mlist@warnfalse + \@ifnextchar[%] + {\@defmlist@opt{#1}} + {\@defmlist@noopt{#1}}} +\def\@defmlist@opt#1[#2]{\@defmlist{#1}{#2}} +\def\@defmlist@noopt#1{\@defmlist{#1}{}} +\newcommand\@defmlist[2]{% + \if@mlist@warn + \ifdefined#1 + \PackageError{mlist}{Command \string#1 already defined} + {\string#1 will be overwritten}% + \fi + \fi + \protected\def#1##1{% + \@ifnextbrace + {\csname\string#1@opt\endcsname{##1}} + {\csname\string#1@noopt\endcsname{##1}}}% + \def@c{\string#1@opt}##1##2{% + \csname\string#1\endcsname{##1}{##2}}% + \def@c{\string#1@noopt}##1{% + \csname\string#1\endcsname{##1}{}}% + \def@c{\string#1}##1##2{% + \@mlist{symbol=##1,#2,index={##2}}}% + \def@c{new\expandafter\@gobble\string#1}##1##2{% + \@mlist@warntrue + \@ifnextchar[%] + {\csname @new\string#1@opt\endcsname{##1}{##2}} + {\csname @new\string#1@noopt\endcsname{##1}{##2}}}% + \def@c{renew\expandafter\@gobble\string#1}##1##2{% + \@mlist@warnfalse + \@ifnextchar[%] + {\csname @new\string#1@opt\endcsname{##1}{##2}} + {\csname @new\string#1@noopt\endcsname{##1}{##2}}}% + \def@c{@new\string#1@opt}##1##2[##3]{% + \csname @new\string#1\endcsname{##1}{##2}{##3}}% + \def@c{@new\string#1@noopt}##1##2{% + \csname @new\string#1\endcsname{##1}{##2}{}}% + \def@c{@new\string#1}##1##2##3{% + \if@mlist@warn + \ifdefined##1 + \PackageError{mlist}{Command \string##1 already defined} + {You cannot overwrite previous definition of \string##1}% + \fi + \fi + \protected\def##1{% + \@ifnextbrace + {\csname @new\string##1@opt\endcsname} + {\@mlist{symbol=##2,#2,##3}}}% + \def@c{@new\string##1@opt}####1{% + \@mlist{symbol=##2,#2,##3,index={####1}}}}% + } +\mlistsetup{% + sep={,}, + sepsep={;}, + wrapcmd=\mlistparen, + wrapone={}{}, + dots=\dots, + dot={\,\cdot\,}, + elemcmd=\mlistelem, + headcmd=\mathbf, + index={}, +} +\newmlist\vect[ + wrapcmd=\mlistparen, + wraponecmd=\mlistnowrap, + elemcmd=\mlistsub, + headcmd=\mathbf, +] +\newmlist\matr[ + sep=&, + sepsep=\\, + elemcmd=\mlistelem, + wrap={\begin{bmatrix}} + {\end{bmatrix}}, +] +\newmlist\func[ + headcmd=\mlisthead, + elemcmd=\mlistelem, + wrapcmd=\mlistheadparen, + wraponecmd, +] +%% +%% Copyright (C) 2007 by Will Robertson <wspr81@gmail.com> +%% +%% Distributable under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) +%% by Will Robertson. +%% +%% This work consists of the file mlist.dtx +%% and the derived files mlist.sty and mlist.pdf. +%% +%% +%% End of file `mlist.sty'. |