summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ytableau
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-02-02 01:12:26 +0000
committerKarl Berry <karl@freefriends.org>2011-02-02 01:12:26 +0000
commit9e41504bb606197683adb78ebc15df4ed8ddeff2 (patch)
tree0d716f5d8696db8674452f2f56a50c33c1306329 /Master/texmf-dist/tex/latex/ytableau
parent3b0d66ad701e2c5b652866fecfbb3f51ff155833 (diff)
ytableau (1feb11)
git-svn-id: svn://tug.org/texlive/trunk@21264 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ytableau')
-rw-r--r--Master/texmf-dist/tex/latex/ytableau/ytableau.sty334
1 files changed, 163 insertions, 171 deletions
diff --git a/Master/texmf-dist/tex/latex/ytableau/ytableau.sty b/Master/texmf-dist/tex/latex/ytableau/ytableau.sty
index a740eb563e0..4dab6dc6c32 100644
--- a/Master/texmf-dist/tex/latex/ytableau/ytableau.sty
+++ b/Master/texmf-dist/tex/latex/ytableau/ytableau.sty
@@ -22,83 +22,81 @@
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ytableau}
- [2010/11/07 v1.0 Many-featured Young tableaux and Young diagrams]
+ [2011/01/31 v1.1 Many-featured Young tableaux and Young diagrams]
-\newbox\ytableau@tableaux
-\newbox\ytableau@thistableau
-\newbox\ytableau@thisbox
-\newbox\ytableau@tmpboxa\newbox\ytableau@tmpboxb
-\setbox\ytableau@tmpboxa=\hbox{$b$}
-\setbox\ytableau@tmpboxb=\hbox{$g$}
-\newtoks\ytableau@toks
-\newtoks\ytableau@opttoksa
-\newtoks\ytableau@opttoksb
-\newdimen\ytableau@boxdim@normal
- \ytableau@boxdim@normal=1.5em
-\newdimen\ytableau@boxdim@save
- \ytableau@boxdim@save=\ytableau@boxdim@normal
-\newdimen\ytableau@boxdim
- \ytableau@boxdim=\ytableau@boxdim@normal
-\newdimen\ytableau@tableauwd
-\newdimen\ytableau@boxframe \ytableau@boxframe=0.4pt
-\newcount\ytableau@diagram@count
-\def\ytableau@ifstar#1{\kernel@ifnextchar *{\@firstoftwo{#1}}}
-\def\ytableau@ignorespaces{$}
-\def\ytableau@thisboxcolor{clear}
-\def\ytableau@centering{top}
-\def\ytableau@defarg{}
-\def\ytableau@tmpa{}
-\def\ytableau@tmpb{}
-\def\ytableau@tmpc{}
-\def\ytableau@compare#1#2{%
- \def\ytableau@tmpa{#1}\def\ytableau@tmpb{#2}%
- \ifx\ytableau@tmpa\ytableau@tmpb%
- \global\@ytableau@eqtrue%
+\newbox\tableaux@YT
+\newbox\thistableau@YT
+\let\thisbox@YT=\thistableau@YT
+\newbox\refhtdp@YT
+ \setbox\refhtdp@YT=\hbox{$bg$}
+\newtoks\toks@YT
+\newtoks\opttoksa@YT
+\newtoks\opttoksb@YT
+\newdimen\boxdim@normal@YT
+ \boxdim@normal@YT=1.5em
+\newdimen\boxdim@save@YT
+ \boxdim@save@YT=\boxdim@normal@YT
+\newdimen\boxdim@YT
+ \boxdim@YT=\boxdim@normal@YT
+\newdimen\tableauwd@YT
+\newdimen\boxframe@YT \boxframe@YT=0.4pt
+\newcount\count@YT
+\def\ifstar@YT#1{\kernel@ifnextchar *{\@firstoftwo{#1}}}
+\def\skipin@YT{$}
+\def\skipout@YT{$}
+\def\thisboxcolor@YT{clear}
+\def\centering@YT{top}
+\def\defarg@YT{}
+\def\compare@YT#1#2{%
+ \def\tmpa@YT{#1}\def\tmpb@YT{#2}%
+ \ifx\tmpa@YT\tmpb@YT%
+ \global\eq@YTtrue%
\else%
- \global\@ytableau@eqfalse%
+ \global\eq@YTfalse%
\fi%
}
-\def\ytableau@compare@#1#2{%
- \def\ytableau@tmpb{#2}%
- \ifx#1\ytableau@tmpb%
- \global\@ytableau@eqtrue%
+\def\compare@@YT#1#2{%
+ \def\tmpb@YT{#2}%
+ \ifx#1\tmpb@YT%
+ \global\eq@YTtrue%
\else%
- \global\@ytableau@eqfalse%
+ \global\eq@YTfalse%
\fi%
}
-\newif\if@ytableau@eq
+\newif\ifeq@YT
\RequirePackage{xkeyval}
\newcommand{\ytableausetup}[1]{\setkeys[ytableau]{setup}{#1}}
\define@key[ytableau]{setup}{boxsize}{%
\setkeys[ytableau]{setup}{nosmalltableaux}%
- \ytableau@compare{#1}{normal}%
- \if@ytableau@eq%
- \global\ytableau@boxdim=\ytableau@boxdim@normal%
+ \compare@YT{#1}{normal}%
+ \ifeq@YT%
+ \global\boxdim@YT=\boxdim@normal@YT%
\else%
- \global\ytableau@boxdim=#1%
+ \global\boxdim@YT=#1%
\fi%
}
\define@choicekey*[ytableau]{setup}{aligntableaux}
{top,center,bottom}[true]{%
- \gdef\ytableau@centering{#1}
+ \gdef\centering@YT{#1}
}
\define@choicekey[ytableau]{setup}{centertableaux}{true}[true]{%
- \gdef\ytableau@centering{center}%
+ \gdef\centering@YT{center}%
}
\define@choicekey[ytableau]{setup}{nocentertableaux}{true}[true]{%
- \gdef\ytableau@centering{top}%
+ \gdef\centering@YT{top}%
}
\define@boolkey[ytableau]{setup}{smalltableaux}[true]{%
\ifytableau@setup@smalltableaux%
- \ifnum\ytableau@boxdim@save>0%
- \gdef\ytableau@defarg{\scriptstyle}%
- \global\ytableau@boxdim@save=-\ytableau@boxdim%
- \global\ytableau@boxdim=.81em%
+ \ifnum\boxdim@save@YT>0%
+ \gdef\defarg@YT{\scriptstyle}%
+ \global\boxdim@save@YT=-\boxdim@YT%
+ \global\boxdim@YT=.81em%
\fi%
\else%
- \ifnum\ytableau@boxdim@save<0%
- \gdef\ytableau@defarg{}%
- \global\ytableau@boxdim=-\ytableau@boxdim@save%
+ \ifnum\boxdim@save@YT<0%
+ \gdef\defarg@YT{}%
+ \global\boxdim@YT=-\boxdim@save@YT%
+ \global\boxdim@save@YT=\boxdim@normal@YT%
\fi%
\fi%
}
@@ -111,9 +109,11 @@
}
\define@boolkey[ytableau]{setup}{textmode}[true]{%
\ifytableau@setup@textmode%
- \global\def\ytableau@ignorespaces{\ignorespaces}%
+ \global\def\skipin@YT{\ignorespaces}%
+ \global\def\skipout@YT{\unskip}%
\else%
- \global\def\ytableau@ignorespaces{$}%
+ \global\def\skipin@YT{$}%
+ \global\def\skipout@YT{$}%
\fi%
}
\define@boolkey[ytableau]{setup}{mathmode}[true]{%
@@ -128,174 +128,166 @@
\RequirePackage{xcolor}
\newenvironment{ytableau}[1][]
{%
- \leavevmode%
- {\iffalse}\fi%
- \global\setbox\ytableau@thistableau=\hbox\bgroup$%
- \m@th%
- \setlength{\fboxrule}{\ytableau@boxframe}%
+ \global\setbox\thistableau@YT=\vtop{\iffalse}\fi%
+ \setlength{\fboxrule}{\boxframe@YT}%
\setlength{\fboxsep}{0pt}%
- \vtop\bgroup%
- \let\\=\ytableau@cr%
- \offinterlineskip%
- \openup-\fboxrule%
- \tabskip=-\fboxrule%
- \halign\bgroup&\ytableau@startbox{\ytableau@defarg}{#1}##%
- \ytableau@endbox\cr%
+ \let\\=\cr@YT%
+ \offinterlineskip%
+ \openup-\fboxrule%
+ \tabskip=-\fboxrule%
+ % \changes{v1.1}{2010/11/10}{Added the everycr fix.}
+ \everycr={}%
+ \halign\bgroup&\startbox@YT{\defarg@YT}{#1}##%
+ \endbox@YT\cr%
}
{%
- \crcr\egroup%
- \egroup%
- $\egroup%
- \iffalse{\fi}%
- \ifnum\wd\ytableau@thistableau>\wd\ytableau@tableaux%
- \ytableau@tableauwd=\wd\ytableau@thistableau%
+ \crcr\egroup%
+ \iffalse{\fi}%
+ \ifnum\wd\thistableau@YT>\wd\tableaux@YT%
+ \tableauwd@YT=\wd\thistableau@YT%
+ \advance\tableauwd@YT by -\wd\tableaux@YT%
\else%
- \ytableau@tableauwd=\wd\ytableau@tableaux%
+ \tableauwd@YT = 0pt%
\fi%
- \wd\ytableau@thistableau=0pt%
- \setbox\ytableau@tableaux%
- =\hbox{\box\ytableau@thistableau\unhbox\ytableau@tableaux}%
- \wd\ytableau@tableaux=\ytableau@tableauwd%
- \ytableau@ifstar%
+ \wd\thistableau@YT=0pt%
+ \setbox\tableaux@YT%
+ =\hbox{\box\thistableau@YT\unhbox\tableaux@YT%
+ \kern\tableauwd@YT}%
+ \ifstar@YT%
{\ydiagram}%
{%
- \ytableau@compare@{\ytableau@centering}{center}%
- \if@ytableau@eq%
- \hbox{$\vcenter{\box\ytableau@tableaux}$}%
- \else\ytableau@compare@{\ytableau@centering}{bottom}%
- \if@ytableau@eq%
- \raise\dp\ytableau@tableaux\box\ytableau@tableaux%
+ \leavevmode%
+ \compare@@YT{\centering@YT}{center}%
+ \ifeq@YT%
+ \hbox{$\vcenter{\box\tableaux@YT}$}%
+ \else\compare@@YT{\centering@YT}{bottom}%
+ \ifeq@YT%
+ \hbox{\raise\dp\tableaux@YT\box\tableaux@YT}%
\fi%
- \setbox\ytableau@tableaux%
- =\hbox{\lower\ht\ytableau@tableaux\box\ytableau@tableaux}%
- \setbox\ytableau@tableaux%
- =\hbox{\raise\ytableau@boxdim\box\ytableau@tableaux}%
- \setbox\ytableau@tableaux%
- =\hbox{\raise2\ytableau@boxframe\box\ytableau@tableaux}%
- \box\ytableau@tableaux%
+ \box\tableaux@YT%
\fi%
}%
}
-\def\ytableau@cr{\cr}
-\def\none{\omit\ytableau@none}
-\newcommand{\ytableau@none}[1][]{%
- \def\ytableau@thisboxcolor{clear}%
- \setlength{\fboxsep}{\ytableau@boxframe}%
+\def\cr@YT{\cr}
+\def\none{\omit\none@YT}
+\newcommand{\none@YT}[1][]{%
+ \def\thisboxcolor@YT{clear}%
+ \setlength{\fboxsep}{\boxframe@YT}%
\setlength{\fboxrule}{0pt}%
- \ytableau@@startbox#1\ytableau@endbox%
+ \startbox@@YT#1\endbox@YT%
\ignorespaces%
}
-\def\ytableau@startbox#1#2{%
- \ytableau@getcolor{\ytableau@save{\ytableau@opttoksa}}#1\@nil%
- \ytableau@getcolor{\ytableau@save{\ytableau@opttoksb}}#2\@nil%
- \ytableau@getcolor%
- {\ytableau@@startbox\the\ytableau@opttoksa\the\ytableau@opttoksb}%
+\def\startbox@YT#1#2{%
+ \getcolor@YT{\save@YT{\opttoksa@YT}}#1\@nil%
+ \getcolor@YT{\save@YT{\opttoksb@YT}}#2\@nil%
+ \getcolor@YT%
+ {\startbox@@YT\the\opttoksa@YT\the\opttoksb@YT}%
}
-\def\ytableau@save#1#2\@nil{#1={#2}}
-\def\ytableau@getcolor#1{\ytableau@ifstar{\ytableau@@getcolor{#1}}{#1}}
-\def\ytableau@@getcolor#1(#2){%
- \def\ytableau@thisboxcolor{#2}%
+\def\save@YT#1#2\@nil{#1={#2}}
+\def\getcolor@YT#1{\ifstar@YT{\getcolor@@YT{#1}}{#1}}
+\def\getcolor@@YT#1(#2){%
+ \def\thisboxcolor@YT{#2}%
#1%
}
-\def\ytableau@@startbox{%
- \setbox\ytableau@thisbox=\hbox to \ytableau@boxdim\bgroup%
+\def\startbox@@YT{%
+ \setbox\thisbox@YT=\hbox to \boxdim@YT\bgroup%
\hss%
- \ytableau@ignorespaces%
+ \skipin@YT%
}
-\def\ytableau@endbox{%
- \ytableau@ignorespaces%
+\def\endbox@YT{%
+ \skipout@YT%
\hss%
\egroup%
- \ht\ytableau@thisbox=\ht\ytableau@tmpboxa%
- \dp\ytableau@thisbox=\dp\ytableau@tmpboxb%
- \ytableau@fcolorbox{\ytableau@thisboxcolor}{%
- \vbox to \ytableau@boxdim{\vss\box\ytableau@thisbox\vss}%
+ \ht\thisbox@YT=\ht\refhtdp@YT%
+ \dp\thisbox@YT=\dp\refhtdp@YT%
+ \fcolorbox@YT{\thisboxcolor@YT}{%
+ \vbox to \boxdim@YT{\vss\box\thisbox@YT\vss}%
}%
}
-\def\ytableau@fcolorbox#1#2{%
- \ytableau@compare@{#1}{clear}%
- \if@ytableau@eq%
+\def\fcolorbox@YT#1#2{%
+ \compare@@YT{#1}{clear}%
+ \ifeq@YT%
\fbox{#2}%
\else%
\fcolorbox{.}{#1}{#2}%
\fi%
}
\newcommand{\ytableaushort}[2][]{%
- \ytableau@toks={}%
- \ytableau@getentries{\ytableau@@getentries}{}#2,\@nil%
- \ytableau[#1]\the\ytableau@toks\endytableau%
+ \toks@YT={}%
+ \getentries@YT{\getentries@@YT}{}#2,\@nil%
+ \ytableau[#1]\the\toks@YT\endytableau%
}
-\def\ytableau@getentries#1#2{\ytableau@getline{#1}{#2}.}
-\def\ytableau@getline#1#2#3,{%
- \ytableau@opttoksa=\expandafter{\@gobble#3}%
- \ytableau@opttoksb={\ytableau@@getline{#1}{#2}}%
- \edef\ytableau@next{\the\ytableau@opttoksb{\the\ytableau@opttoksa}}%
- \ytableau@next%
+\def\getentries@YT#1#2{\getline@YT{#1}{#2}.}
+\def\getline@YT#1#2#3,{%
+ \opttoksa@YT=\expandafter{\@gobble#3}%
+ \opttoksb@YT={\getline@@YT{#1}{#2}}%
+ \edef\next@YT{\the\opttoksb@YT{\the\opttoksa@YT}}%
+ \next@YT%
}
-\def\ytableau@@getline#1#2#3#4{%
- \ytableau@compare{#4}{,}%
- \if@ytableau@eq%
- \def\ytableau@next{\ytableau@@getline{#1}{#2}{#3}}%
+\def\getline@@YT#1#2#3#4{%
+ \compare@YT{#4}{,}%
+ \ifeq@YT%
+ \def\next@YT{\getline@@YT{#1}{#2}{#3}}%
\else%
- \ytableau@compare{#4}{\@nil}%
- \if@ytableau@eq%
- \def\ytableau@next{#1#3#2\@nil}%
+ \compare@YT{#4}{\@nil}%
+ \ifeq@YT%
+ \def\next@YT{#1#3#2\@nil}%
\else%
- \def\ytableau@next{#1#3#2\@nil\ytableau@getentries{#1}{#2}{#4}}%
+ \def\next@YT{#1#3#2\@nil\getentries@YT{#1}{#2}{#4}}%
\fi%
\fi%
- \ytableau@next%
+ \next@YT%
}
-\def\ytableau@@getentries#1#2{%
- \ytableau@compare{#2}{\@nil}%
- \if@ytableau@eq%
- \ytableau@toks=\expandafter{\the\ytableau@toks#1\\}%
- \def\ytableau@next{}%
+\def\getentries@@YT#1#2{%
+ \compare@YT{#2}{\@nil}%
+ \ifeq@YT%
+ \toks@YT=\expandafter{\the\toks@YT#1\\}%
+ \def\next@YT{}%
\else%
- \ytableau@toks=\expandafter{\the\ytableau@toks#1&}%
- \def\ytableau@next{\ytableau@@getentries{#2}}%
+ \toks@YT=\expandafter{\the\toks@YT#1&}%
+ \def\next@YT{\getentries@@YT{#2}}%
\fi%
- \ytableau@next%
+ \next@YT%
}
\newcommand\ydiagram[2][]{%
- \ytableau@toks={}%
- \ytableau@getentries{\ytableau@diagram@getentries}{+}#2,\@nil%
- \ytableau[#1]\the\ytableau@toks\endytableau%
+ \toks@YT={}%
+ \getentries@YT{\getnumbers@YT}{+}#2,\@nil%
+ \ytableau[#1]\the\toks@YT\endytableau%
}
-\def\ytableau@diagram@getentries#1+#2\@nil{%
- \ytableau@compare{#2}{}%
- \if@ytableau@eq%
- \def\ytableau@next{%
- \ytableau@loop{#1}{}%
+\def\getnumbers@YT#1+#2\@nil{%
+ \compare@YT{#2}{}%
+ \ifeq@YT%
+ \def\next@YT{%
+ \loop@YT{#1}{}%
}%
\else%
- \def\ytableau@next{%
- \ytableau@loop{#1}{\none}%
- \ytableau@diagram@getentries#2\@nil%
+ \def\next@YT{%
+ \loop@YT{#1}{\none}%
+ \getnumbers@YT#2\@nil%
}%
\fi%
- \ytableau@next%
+ \next@YT%
}
-\def\ytableau@loop#1#2{%
- \ytableau@fullexpand{#1}%
- \loop\ifnum\ytableau@diagram@count>1%
- \ytableau@toks=\expandafter{\the\ytableau@toks#2&}%
- \advance\ytableau@diagram@count by -1%
+\def\loop@YT#1#2{%
+ \fullexpand@YT{#1}%
+ \loop\ifnum\count@YT>1%
+ \toks@YT=\expandafter{\the\toks@YT#2&}%
+ \advance\count@YT by -1%
\repeat%
- \ifnum\ytableau@diagram@count=1%
- \ytableau@compare{#2}{}%
- \if@ytableau@eq%
- \ytableau@toks=\expandafter{\the\ytableau@toks#2\\}%
+ \ifnum\count@YT=1%
+ \compare@YT{#2}{}%
+ \ifeq@YT%
+ \toks@YT=\expandafter{\the\toks@YT#2\\}%
\else
- \ytableau@toks=\expandafter{\the\ytableau@toks#2&}%
+ \toks@YT=\expandafter{\the\toks@YT#2&}%
\fi%
\fi%
}
-\def\ytableau@fullexpand#1{%
- \def\ytableau@tmpa##1{##1}%
- \edef\ytableau@tmpb{\ytableau@tmpa#1}%
- \edef\ytableau@tmpc{\ytableau@tmpb}%
- \ytableau@diagram@count=\ytableau@tmpc%
+\def\fullexpand@YT#1{%
+ \def\tmpa@YT##1{##1}%
+ \edef\tmpb@YT{\tmpa@YT#1}%
+ \edef\tmpc@YT{\tmpb@YT}%
+ \count@YT=\tmpc@YT%
}
\endinput
%%