diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-14 16:20:20 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-14 16:20:20 +0000 |
commit | 48b56d799036b3732d15096eff82a9c1788f252f (patch) | |
tree | c73ff75edc868781a5c61d267dfd67739c68290a /Master/texmf-dist/tex/latex/ytableau | |
parent | 7913241805e65e711cfbb1dabbd2abd2246f0c59 (diff) |
ytableau (20jun12)
git-svn-id: svn://tug.org/texlive/trunk@27044 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ytableau')
-rw-r--r-- | Master/texmf-dist/tex/latex/ytableau/ytableau.sty | 361 |
1 files changed, 194 insertions, 167 deletions
diff --git a/Master/texmf-dist/tex/latex/ytableau/ytableau.sty b/Master/texmf-dist/tex/latex/ytableau/ytableau.sty index 4dab6dc6c32..9a4203d2dcd 100644 --- a/Master/texmf-dist/tex/latex/ytableau/ytableau.sty +++ b/Master/texmf-dist/tex/latex/ytableau/ytableau.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2010 by Ryan Reich <ryan.reich@gmail.com> +%% Copyright (C) 2010--2012 by Ryan Reich <ryan.reich@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 @@ -22,272 +22,299 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{ytableau} - [2011/01/31 v1.1 Many-featured Young tableaux and Young diagrams] + [2012/06/17 v1.2 Many-featured Young tableaux and Young diagrams] + \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\expandonce@YT#1{% + \expandafter\unexpanded\expandafter{#1}% +} +\def\nil@YT{\nil@YT} +\def\boxframe@YT{0.04em} +\def\boxdim@normal@YT{1.5em} +\let\boxdim@save@YT = \boxdim@normal@YT +\edef\macro@boxdim@YT{\boxdim@normal@YT} +\def\font@YT{} +\def\set@mathmode@YT{% + \gdef\skipin@YT{$}% + \gdef\skipout@YT{$}% + \def\smallfont@YT{\scriptstyle}% +} +\def\set@textmode@YT{% + \gdef\skipin@YT{\ignorespaces}% + \gdef\skipout@YT{\unskip}% + \def\smallfont@YT{\scriptsize}% +} +\set@mathmode@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\eq@YTfalse% - \fi% + \ifx\tmpa@YT\tmpb@YT + \global\eq@YTtrue + \else + \global\eq@YTfalse + \fi } \def\compare@@YT#1#2{% \def\tmpb@YT{#2}% - \ifx#1\tmpb@YT% - \global\eq@YTtrue% - \else% - \global\eq@YTfalse% - \fi% + \ifx#1\tmpb@YT + \global\eq@YTtrue + \else + \global\eq@YTfalse + \fi } \newif\ifeq@YT -\RequirePackage{xkeyval} -\newcommand{\ytableausetup}[1]{\setkeys[ytableau]{setup}{#1}} -\define@key[ytableau]{setup}{boxsize}{% - \setkeys[ytableau]{setup}{nosmalltableaux}% - \compare@YT{#1}{normal}% - \ifeq@YT% - \global\boxdim@YT=\boxdim@normal@YT% - \else% - \global\boxdim@YT=#1% - \fi% -} -\define@choicekey*[ytableau]{setup}{aligntableaux} - {top,center,bottom}[true]{% - \gdef\centering@YT{#1} -} -\define@choicekey[ytableau]{setup}{centertableaux}{true}[true]{% - \gdef\centering@YT{center}% -} -\define@choicekey[ytableau]{setup}{nocentertableaux}{true}[true]{% - \gdef\centering@YT{top}% +\RequirePackage{pgfkeys} +\pgfkeys{/ytableau/options/.is family} +\newcommand{\ytableausetup}[1]{\pgfkeys{/ytableau/options,#1}} +\pgfkeys{/ytableau/options, + boxsize/.value required, + boxsize/.code = {% + \pgfkeysalso{nosmalltableaux}% + \compare@YT{#1}{normal}% + \ifeq@YT + \xdef\macro@boxdim@YT{\expandonce@YT\boxdim@normal@YT}% + \else + \xdef\macro@boxdim@YT{#1}% + \fi + } } -\define@boolkey[ytableau]{setup}{smalltableaux}[true]{% - \ifytableau@setup@smalltableaux% - \ifnum\boxdim@save@YT>0% - \gdef\defarg@YT{\scriptstyle}% - \global\boxdim@save@YT=-\boxdim@YT% - \global\boxdim@YT=.81em% - \fi% - \else% - \ifnum\boxdim@save@YT<0% - \gdef\defarg@YT{}% - \global\boxdim@YT=-\boxdim@save@YT% - \global\boxdim@save@YT=\boxdim@normal@YT% - \fi% - \fi% +\pgfkeys{/ytableau/options, + aligntableaux/.value required, + aligntableaux/.is choice, + aligntableaux/top/.code = {\gdef\centering@YT{top}}, + aligntableaux/center/.code = {\gdef\centering@YT{center}}, + aligntableaux/bottom/.code = {\gdef\centering@YT{bottom}}, + centertableaux/.value forbidden, + centertableaux/.style = {aligntableaux/center}, + nocentertableaux/.value forbidden, + nocentertableaux/.style = {aligntableaux/top} } -\define@boolkey[ytableau]{setup}{nosmalltableaux}[true]{% - \ifytableau@setup@nosmalltableaux% - \setkeys[ytableau]{setup}{smalltableaux=false}% - \else% - \setkeys[ytableau]{setup}{smalltableaux=true}% - \fi% +\newif\ifsmalltableaux@YT +\pgfkeys{/ytableau/options, + smalltableaux/.default = true, + smalltableaux/.is choice, + smalltableaux/true/.code = {% + \ifsmalltableaux@YT\else + \global\smalltableaux@YTtrue + \gdef\font@YT{\smallfont@YT}% + \xdef\boxdim@save@YT{\expandonce@YT\macro@boxdim@YT}% + \gdef\macro@boxdim@YT{% + \dimexpr \ht\refhtdp@YT + \dp\refhtdp@YT + 0.1em\relax + } + \fi + }, + smalltableaux/false/.code = {% + \ifsmalltableaux@YT + \global\smalltableaux@YTfalse + \gdef\font@YT{}% + \xdef\macro@boxdim@YT{\expandonce@YT\boxdim@save@YT}% + \fi + }, + smalltableaux/on/.style = {smalltableaux/true}, + smalltableaux/off/.style = {smalltableaux/false}, + nosmalltableaux/.value forbidden, + nosmalltableaux/.style = {smalltableaux/false} } -\define@boolkey[ytableau]{setup}{textmode}[true]{% - \ifytableau@setup@textmode% - \global\def\skipin@YT{\ignorespaces}% - \global\def\skipout@YT{\unskip}% - \else% - \global\def\skipin@YT{$}% - \global\def\skipout@YT{$}% - \fi% +\pgfkeys{/ytableau/options, + textmode/.value forbidden, + textmode/.code = \set@textmode@YT, + mathmode/.value forbidden, + mathmode/.code = \set@mathmode@YT, } -\define@boolkey[ytableau]{setup}{mathmode}[true]{% - \ifytableau@setup@mathmode% - \setkeys[ytableau]{setup}{textmode=false}% - \else% - \setkeys[ytableau]{setup}{textmode=true}% - \fi% +\newif\ifbaseline@YT +\pgfkeys{/ytableau/options, + baseline/.is if = baseline@YT, + baseline/.default = true, + nobaseline/.style = {baseline = false}, + centerboxes/.style = {baseline = false}, } -\DeclareOptionX*{\PassOptionsToPackage{\CurrentOption}{xcolor}} -\ProcessOptionsX[ytableau]<setup>[] +\ytableausetup{nosmalltableaux,mathmode,baseline} +\RequirePackage{pgfopts} +\ProcessPgfPackageOptions{/ytableau/options} \RequirePackage{xcolor} \newenvironment{ytableau}[1][] {% - \global\setbox\thistableau@YT=\vtop{\iffalse}\fi% - \setlength{\fboxrule}{\boxframe@YT}% - \setlength{\fboxsep}{0pt}% - \let\\=\cr@YT% - \offinterlineskip% - \openup-\fboxrule% - \tabskip=-\fboxrule% + \global\setbox\thistableau@YT=\vtop{\iffalse}\fi + \def\none{\omit\none@YT} + \setbox\refhtdp@YT=\hbox{\skipin@YT\font@YT (\skipout@YT}% + \boxdim@YT=\macro@boxdim@YT\relax + \fboxrule=\boxframe@YT\relax + \fboxsep=0pt % + \let\\=\cr@YT + \tabskip=0pt % + \offinterlineskip + \openup-\fboxrule % \changes{v1.1}{2010/11/10}{Added the everycr fix.} \everycr={}% - \halign\bgroup&\startbox@YT{\defarg@YT}{#1}##% - \endbox@YT\cr% + \halign\bgroup&\tabskip=-\fboxrule + \startbox@YT{\font@YT}{#1}##\endbox@YT\cr } {% - \crcr\egroup% + \crcr\egroup \iffalse{\fi}% - \ifnum\wd\thistableau@YT>\wd\tableaux@YT% - \tableauwd@YT=\wd\thistableau@YT% - \advance\tableauwd@YT by -\wd\tableaux@YT% - \else% - \tableauwd@YT = 0pt% - \fi% - \wd\thistableau@YT=0pt% - \setbox\tableaux@YT% - =\hbox{\box\thistableau@YT\unhbox\tableaux@YT% + \ifnum\wd\thistableau@YT>\wd\tableaux@YT + \tableauwd@YT=\wd\thistableau@YT + \advance\tableauwd@YT by \fboxrule + \wd\thistableau@YT = \tableauwd@YT + \advance\tableauwd@YT by -\wd\tableaux@YT + \else + \tableauwd@YT = 0pt % + \fi + \wd\thistableau@YT=0pt % + \setbox\tableaux@YT + =\hbox{\box\thistableau@YT\unhbox\tableaux@YT \kern\tableauwd@YT}% - \ifstar@YT% + \ifstar@YT {\ydiagram}% {% - \leavevmode% + \leavevmode \compare@@YT{\centering@YT}{center}% - \ifeq@YT% + \ifeq@YT \hbox{$\vcenter{\box\tableaux@YT}$}% \else\compare@@YT{\centering@YT}{bottom}% - \ifeq@YT% + \ifeq@YT \hbox{\raise\dp\tableaux@YT\box\tableaux@YT}% - \fi% - \box\tableaux@YT% - \fi% + \fi + \box\tableaux@YT + \fi }% } \def\cr@YT{\cr} -\def\none{\omit\none@YT} \newcommand{\none@YT}[1][]{% \def\thisboxcolor@YT{clear}% - \setlength{\fboxsep}{\boxframe@YT}% - \setlength{\fboxrule}{0pt}% - \startbox@@YT#1\endbox@YT% - \ignorespaces% + \fboxsep = \boxframe@YT\relax + \fboxrule = 0pt % + \startbox@@YT#1\endbox@YT + \nullfont } \def\startbox@YT#1#2{% - \getcolor@YT{\save@YT{\opttoksa@YT}}#1\@nil% - \getcolor@YT{\save@YT{\opttoksb@YT}}#2\@nil% - \getcolor@YT% + \getcolor@YT{\save@YT{\opttoksa@YT}}#1\nil@YT + \getcolor@YT{\save@YT{\opttoksb@YT}}#2\nil@YT + \getcolor@YT {\startbox@@YT\the\opttoksa@YT\the\opttoksb@YT}% } -\def\save@YT#1#2\@nil{#1={#2}} +\def\save@YT#1#2\nil@YT{#1={#2}} \def\getcolor@YT#1{\ifstar@YT{\getcolor@@YT{#1}}{#1}} \def\getcolor@@YT#1(#2){% \def\thisboxcolor@YT{#2}% #1% } \def\startbox@@YT{% - \setbox\thisbox@YT=\hbox to \boxdim@YT\bgroup% - \hss% - \skipin@YT% + \setbox\thisbox@YT=\hbox to \boxdim@YT\bgroup + \hss + \skipin@YT } \def\endbox@YT{% - \skipout@YT% - \hss% - \egroup% - \ht\thisbox@YT=\ht\refhtdp@YT% - \dp\thisbox@YT=\dp\refhtdp@YT% + \skipout@YT + \hss + \egroup + \ifbaseline@YT + \ht\thisbox@YT=\ht\refhtdp@YT + \dp\thisbox@YT=\dp\refhtdp@YT + \fi \fcolorbox@YT{\thisboxcolor@YT}{% \vbox to \boxdim@YT{\vss\box\thisbox@YT\vss}% }% } \def\fcolorbox@YT#1#2{% \compare@@YT{#1}{clear}% - \ifeq@YT% + \ifeq@YT \fbox{#2}% - \else% + \else \fcolorbox{.}{#1}{#2}% - \fi% + \fi } \newcommand{\ytableaushort}[2][]{% \toks@YT={}% - \getentries@YT{\getentries@@YT}{}#2,\@nil% - \ytableau[#1]\the\toks@YT\endytableau% + \getentries@YT{\getentries@@YT}{}#2,\nil@YT + \ytableau[#1]\the\toks@YT\endytableau } \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% + \futurelet\tmpa@YT\next@YT } -\def\getline@@YT#1#2#3#4{% - \compare@YT{#4}{,}% - \ifeq@YT% - \def\next@YT{\getline@@YT{#1}{#2}{#3}}% - \else% - \compare@YT{#4}{\@nil}% - \ifeq@YT% - \def\next@YT{#1#3#2\@nil}% - \else% - \def\next@YT{#1#3#2\@nil\getentries@YT{#1}{#2}{#4}}% - \fi% - \fi% - \next@YT% +\def\getline@@YT#1#2#3{% + \ifx\tmpa@YT\nil@YT + \compare@YT{#3}{}% + \ifeq@YT + \def\next@YT{\@gobble}% + \else + \def\next@YT{#1#3#2}% + \fi + \else + \compare@YT{#3}{}% + \ifeq@YT + \def\next@YT{\getline@YT{#1}{#2}.}% + \else + \def\next@YT{#1#3#2\nil@YT\getentries@YT{#1}{#2}}% + \fi + \fi + \next@YT } \def\getentries@@YT#1#2{% - \compare@YT{#2}{\@nil}% - \ifeq@YT% + \compare@YT{#2}{\nil@YT}% + \ifeq@YT \toks@YT=\expandafter{\the\toks@YT#1\\}% \def\next@YT{}% - \else% + \else \toks@YT=\expandafter{\the\toks@YT#1&}% \def\next@YT{\getentries@@YT{#2}}% - \fi% - \next@YT% + \fi + \next@YT } \newcommand\ydiagram[2][]{% \toks@YT={}% - \getentries@YT{\getnumbers@YT}{+}#2,\@nil% - \ytableau[#1]\the\toks@YT\endytableau% + \getentries@YT{\getnumbers@YT}{+}#2,\nil@YT + \ytableau[#1]\the\toks@YT\endytableau } -\def\getnumbers@YT#1+#2\@nil{% +\def\getnumbers@YT#1+#2\nil@YT{% \compare@YT{#2}{}% - \ifeq@YT% + \ifeq@YT \def\next@YT{% \loop@YT{#1}{}% }% - \else% + \else \def\next@YT{% \loop@YT{#1}{\none}% - \getnumbers@YT#2\@nil% + \getnumbers@YT#2\nil@YT }% - \fi% - \next@YT% + \fi + \next@YT } \def\loop@YT#1#2{% - \fullexpand@YT{#1}% - \loop\ifnum\count@YT>1% + \count@YT=#1\relax + \loop\ifnum\count@YT>1 % \toks@YT=\expandafter{\the\toks@YT#2&}% - \advance\count@YT by -1% - \repeat% - \ifnum\count@YT=1% + \advance\count@YT by -1 % + \repeat + \ifnum\count@YT=1 % \compare@YT{#2}{}% - \ifeq@YT% + \ifeq@YT \toks@YT=\expandafter{\the\toks@YT#2\\}% \else \toks@YT=\expandafter{\the\toks@YT#2&}% - \fi% - \fi% -} -\def\fullexpand@YT#1{% - \def\tmpa@YT##1{##1}% - \edef\tmpb@YT{\tmpa@YT#1}% - \edef\tmpc@YT{\tmpb@YT}% - \count@YT=\tmpc@YT% + \fi + \else + \compare@YT{#2}{}% + \ifeq@YT + \toks@YT=\expandafter{\the\toks@YT\none\\}% + \fi + \fi } \endinput %% |