summaryrefslogtreecommitdiff
path: root/Master
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
parent3b0d66ad701e2c5b652866fecfbb3f51ff155833 (diff)
ytableau (1feb11)
git-svn-id: svn://tug.org/texlive/trunk@21264 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/ytableau/ytableau.pdfbin399314 -> 420761 bytes
-rw-r--r--Master/texmf-dist/source/latex/ytableau/ytableau.dtx681
-rw-r--r--Master/texmf-dist/tex/latex/ytableau/ytableau.sty334
3 files changed, 526 insertions, 489 deletions
diff --git a/Master/texmf-dist/doc/latex/ytableau/ytableau.pdf b/Master/texmf-dist/doc/latex/ytableau/ytableau.pdf
index cd67f6abdfc..b4183342fd6 100644
--- a/Master/texmf-dist/doc/latex/ytableau/ytableau.pdf
+++ b/Master/texmf-dist/doc/latex/ytableau/ytableau.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/ytableau/ytableau.dtx b/Master/texmf-dist/source/latex/ytableau/ytableau.dtx
index 7061a721619..f5b4f3c85b9 100644
--- a/Master/texmf-dist/source/latex/ytableau/ytableau.dtx
+++ b/Master/texmf-dist/source/latex/ytableau/ytableau.dtx
@@ -18,13 +18,68 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{ytableau}
-%<package> [2010/11/07 v1.0 Many-featured Young tableaux and Young diagrams]
+%<package> [2011/01/31 v1.1 Many-featured Young tableaux and Young diagrams]
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{ytableau,amsmath,microtype,changepage}
\usepackage[numbered]{hypdoc}
\hypersetup{colorlinks,linkcolor=blue}
+
+\makeatletter
+\def\DescribeOption{\leavevmode\@bsphack\begingroup\MakePrivateLetters
+ \Describe@Option}
+\def\Describe@Option#1{\endgroup
+ \marginpar{\raggedleft\PrintDescribeOption{#1}}%
+ \SpecialOptionIndex{#1}\@esphack\ignorespaces}
+\let\PrintDescribeOption=\PrintDescribeEnv
+\def\option{\begingroup
+ \catcode`\\12
+ \MakePrivateLetters \m@cro@YT}
+\long\def\m@cro@YT#1{\endgroup \topsep\MacroTopsep \trivlist
+ \edef\saved@macroname{\string#1}%
+ \def\makelabel##1{\llap{##1}}%
+ \if@inlabel
+ \let\@tempa\@empty \count@\macro@cnt
+ \loop \ifnum\count@>\z@
+ \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
+ \edef\makelabel##1{\llap{\vtop to\baselineskip
+ {\@tempa\hbox{##1}\vss}}}%
+ \advance \macro@cnt \@ne
+ \else \macro@cnt\@ne \fi
+ \edef\@tempa{\noexpand\item[%
+ \noexpand\PrintOptionName
+ {\string#1}]}%
+ \@tempa
+ \global\advance\c@CodelineNo\@ne
+ \SpecialMainOptionIndex{#1}\nobreak
+ \global\advance\c@CodelineNo\m@ne
+ \ignorespaces}
+\let\endoption\endtrivlist
+\let\PrintOptionName=\PrintEnvName
+\newcommand*\SpecialOptionIndex[1]{%
+ \@bsphack
+ \begingroup
+ \HD@target
+ \let\HDorg@encapchar\encapchar
+ \edef\encapchar usage{%
+ \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
+ }%
+ \index{#1\actualchar{\protect\ttfamily#1} (option)\encapchar usage}%
+ \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar usage}%
+ \endgroup
+ \@esphack
+}
+\def\SpecialMainOptionIndex#1{\@bsphack\special@index{%
+ #1\actualchar
+ {\string\ttfamily\space#1}
+ (option)%
+ \encapchar main}%
+ \special@index{options:\levelchar#1\actualchar{%
+ \string\ttfamily\space#1}\encapchar
+ main}\@esphack}
+\makeatother
+
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -34,14 +89,16 @@
\setlength{\newleftmargin}{\marginparwidth}
\addtolength{\newleftmargin}{-0.5in}
\newpage
- \begin{adjustwidth}{-\newleftmargin}{-0.5in}
+\begin{adjustwidth}{-\newleftmargin}{-0.5in}
+ \PrintChanges
+ \newpage
\PrintIndex
\end{adjustwidth}
\end{document}
%</driver>
% \fi
%
-% \CheckSum{494}
+% \CheckSum{471}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -64,7 +121,7 @@
%
% \GetFileInfo{ytableau.sty}
%
-% \DoNotIndex{\@firstoftwo,\@gobble,\@ytableau@eqfalse,\@ytableau@eqtrue}
+% \DoNotIndex{\@firstoftwo,\@gobble,\eq@YTfalse,\eq@YTtrue}
% \DoNotIndex{\advance}
% \DoNotIndex{\bgroup,\box}
% \DoNotIndex{\crcr,\CurrentOption}
@@ -266,19 +323,19 @@
% \section{Package options}
% The package accepts the following options:
% \begin{itemize}
-% \item \DescribeMacro{boxsize}
+% \item \DescribeOption{boxsize}
% |boxsize|=\meta{dimension}. This manually sets the height (and width, which is the same)
% of boxes in all tableaux to \meta{dimension}. If you change the size and want to get back to
% the default (1.5em), just say |boxsize = normal|.
%
-% \item \DescribeMacro{smalltableaux} \DescribeMacro{nosmalltableaux}
+% \item \DescribeOption{smalltableaux} \DescribeOption{nosmalltableaux}
% |smalltableaux|/|nosmalltableaux|. The first option makes the box size quite small;
% indeed, small enough to fit a |$f$| precisely, as computed by careful eyeballing tests.
% It also passes |\scriptstyle| to each box, which as usual can be overridden if you wish (but you
% don't). The second option returns things to how they were.
%
-% \item \DescribeMacro{aligntableaux} \DescribeMacro{centertableaux}
-% \DescribeMacro{nocentertableaux}
+% \item \DescribeOption{aligntableaux} \DescribeOption{centertableaux}
+% \DescribeOption{nocentertableaux}
% |aligntableaux|=\meta{alignment}/|centertableaux|/|nocentertableaux|. The first argument
% allows any of |top|, |center|, or |bottom|. With |top|, the tableaux are all aligned on the
% baseline of their top row, with |bottom| they are aligned on the baseline of their bottom row,
@@ -286,7 +343,7 @@
% arguments are semantically pleasing shorthand for |aligntableaux = center| and
% |aligntableaux = top|.
%
-% \item \DescribeMacro{textmode} \DescribeMacro{mathmode}
+% \item \DescribeOption{textmode} \DescribeOption{mathmode}
% |textmode|/|mathmode|. The former sets all the boxes in text mode, and the latter returns
% to math mode (the default).
% \end{itemize}
@@ -307,18 +364,18 @@
% \begin{center}
% \ytableausetup{centertableaux}
% \begin{ytableau}
-% 1 & 3 & 5 \\
-% 2 & 4 \\
-% 6
+% a & d & f \\
+% b & e & g \\
+% c
% \end{ytableau}
% \hfill
% \begin{minipage}{0.5\textwidth}
% \begin{verbatim}
% \ytableausetup{centertableaux}
% \begin{ytableau}
-% 1 & 3 & 5 \\
-% 2 & 4 \\
-% 6
+% a & d & f \\
+% b & e & g \\
+% c
% \end{ytableau}
% \end{verbatim}
% \end{minipage}
@@ -326,12 +383,20 @@
%
% \begin{center}
% \ytableausetup{textmode}
-% \ytableaushort{ace,bd,f}
+% \begin{ytableau}
+% a & d & f \\
+% b & e & g \\
+% c
+% \end{ytableau}
% \hfill
% \begin{minipage}{0.5\textwidth}
% \begin{verbatim}
% \ytableausetup{textmode}
-% \ytableaushort{ace,bd,f}
+% \begin{ytableau}
+% a & d & f \\
+% b & e & g \\
+% c
+% \end{ytableau}
% \end{verbatim}
% \end{minipage}
% \end{center}
@@ -491,11 +556,11 @@
% \hfill
% \begin{minipage}{0.5\textwidth}
% \begin{verbatim}
-% \ytableausetup{centertableaux}
-% \ytableaushort
-% {\none,\none ab,\none c}
-% * [*(yellow)]{4,3,2,1}
-% * {4,1,1,1}
+% \ytableausetup{centertableaux}
+% \ytableaushort
+% {\none,\none ab, \none c}
+% * {4,3,2,1}
+% * [*(yellow)]{4,1,1,1}
% \end{verbatim}
% \end{minipage}
% \end{center}
@@ -517,6 +582,7 @@
% \StopEventually{}
%
% \section{The Code}
+% \changes{v1.1}{2011/01/31}{Changed the namespace convention from \texttt{ytableau@...} to \texttt{...@YT} to make the index useful and the macros shorter.}
%
% \subsection{Global defintions}
%
@@ -524,201 +590,187 @@
%
% \subsubsection{Box registers}
%
-% \begin{macro}{\ytableau@tableaux}
+% \begin{macro}{\tableaux@YT}
% When chaining, collects the successive tableaux.
-% \begin{macro}{\ytableau@thistableau}
-% When chaining, stores the present tableaux in the chain.
+% \begin{macro}{\thistableau@YT}
+% When chaining, stores the current tableaux in the chain.
% \\
% Used in |\endytableau|.
% \begin{macrocode}
-\newbox\ytableau@tableaux
-\newbox\ytableau@thistableau
+\newbox\tableaux@YT
+\newbox\thistableau@YT
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\ytableau@thisbox}
-% Stores the box currently being constructed.
-% Used in |\ytableau@@startbox| and |\ytableau@endbox|.
+% \begin{macro}{\thisbox@YT}
+% \changes{v1.1}{2011/01/31}{Made \texttt{\textbackslash thisbox@YT} an alias for \texttt{\textbackslash thistableau@YT}.}
+% Stores the box currently being constructed. We define it as an alias because it is local to the construction of |\thistableau@YT| and, afterwards, irrelevant. Used in |\startbox@@YT| and |\endbox@YT|.
% \begin{macrocode}
-\newbox\ytableau@thisbox
+\let\thisbox@YT=\thistableau@YT
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@tmpboxa}
-% \begin{macro}{\ytableau@tmpboxb}
+% \begin{macro}{\refhtdp@YT}
+% \changes{v1.1}{2011/01/31}{Put the reference letters into a single box and renamed it more semantically.}
% Boxes to hold our reference-height and reference-depth letters.
-% Is |$b$| the tallest and |$g$| the deepest? Used in |\ytableau@@endbox|.
+% Is |$b$| the tallest and |$g$| the deepest? Used in |\endbox@YT|.
% \begin{macrocode}
-\newbox\ytableau@tmpboxa\newbox\ytableau@tmpboxb
-\setbox\ytableau@tmpboxa=\hbox{$b$}
-\setbox\ytableau@tmpboxb=\hbox{$g$}
+\newbox\refhtdp@YT
+ \setbox\refhtdp@YT=\hbox{$bg$}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \subsubsection{Token registers}
%
-% \begin{macro}{\ytableau@toks}
+% \begin{macro}{\toks@YT}
% Accumulates what will be put in the |ytableau| environment.
-% Used in |\ydiagram|, |\ytableau@diagram@getentries|,
-% |\ytableau@@getentries|, |\ytableau@loop|, \& |\ytableaushort|.
+% Used in |\ydiagram|, |\getnumbers@YT|,
+% |\getentries@@YT|, |\loop@YT|, and |\ytableaushort|.
% \begin{macrocode}
-\newtoks\ytableau@toks
+\newtoks\toks@YT
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@opttoksa}
-% \begin{macro}{\ytableau@opttoksb}
+% \begin{macro}{\opttoksa@YT}
+% \begin{macro}{\opttoksb@YT}
% Store the optional arguments (minus color specifications) when processing each entry of the
% tableau. Also used as temporary token registers.
-% Used in |\ytableau@startbox|, |\ytableau@getline|.
+% Used in |\startbox@YT|, |\getline@YT|.
% \begin{macrocode}
-\newtoks\ytableau@opttoksa
-\newtoks\ytableau@opttoksb
+\newtoks\opttoksa@YT
+\newtoks\opttoksb@YT
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{Dimension registers}
%
-% \begin{macro}{\ytableau@boxdim@normal}
-% \begin{macro}{\ytableau@boxdim@save}
+% \begin{macro}{\boxdim@normal@YT}
+% \begin{macro}{\boxdim@save@YT}
% Respectively, these record the |normal| size of a box in a tableau for use in option |boxsize|,
% and the previously used size when using the option pair |smalltableaux|, |nosmalltableaux|.
% Used in options |boxsize|, |smalltableaux|, |nosmalltableaux|.
% \begin{macrocode}
-\newdimen\ytableau@boxdim@normal
- \ytableau@boxdim@normal=1.5em
-\newdimen\ytableau@boxdim@save
- \ytableau@boxdim@save=\ytableau@boxdim@normal
+\newdimen\boxdim@normal@YT
+ \boxdim@normal@YT=1.5em
+\newdimen\boxdim@save@YT
+ \boxdim@save@YT=\boxdim@normal@YT
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\ytableau@boxdim}
+% \begin{macro}{\boxdim@YT}
% The size of the boxes in a tableau.
-% Used in |\none|, |\ytableau@@start|, |\ytableau@end|.
+% Used in |\none|, |\start@@YT|, |\end@YT|.
% \begin{macrocode}
-\newdimen\ytableau@boxdim
- \ytableau@boxdim=\ytableau@boxdim@normal
+\newdimen\boxdim@YT
+ \boxdim@YT=\boxdim@normal@YT
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@tableauwd}
+% \begin{macro}{\tableauwd@YT}
% Save the total width of a tableau for supporting the ``chaining'' operation. Used in
% |\endytableau|.
% \begin{macrocode}
-\newdimen\ytableau@tableauwd
+\newdimen\tableauwd@YT
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@boxframe}
+% \begin{macro}{\boxframe@YT}
% The width of the frame in a tableau. Used in |\ytableau| and |\endytableau|.
% \begin{macrocode}
-\newdimen\ytableau@boxframe \ytableau@boxframe=0.4pt
+\newdimen\boxframe@YT \boxframe@YT=0.4pt
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Count registers}
%
-% \begin{macro}{\ytableau@diagram@count}
+% \begin{macro}{\count@YT}
% Just a counter for looping.
-% Used in |\ytableau@loop|, |\ytableau@fullexpand|.
+% Used in |\loop@YT|, |\fullexpand@YT|.
% \begin{macrocode}
-\newcount\ytableau@diagram@count
+\newcount\count@YT
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Macros}
%
-% \begin{macro}{\ytableau@ifstar}
+% \begin{macro}{\ifstar@YT}
% Fix a bug with |amsmath| where |\@ifnextchar| (used in |\@ifstar|) doesn't ignore spaces.
% \begin{macrocode}
-\def\ytableau@ifstar#1{\kernel@ifnextchar *{\@firstoftwo{#1}}}
+\def\ifstar@YT#1{\kernel@ifnextchar *{\@firstoftwo{#1}}}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@ignorespaces}
+% \begin{macro}{\skipin@YT}
+% \begin{macro}{\skipout@YT}
+% \changes{v1.1}{2011/01/31}{Split up the ``skip in'' and ``skip out'' macros.}
% Stores the delimiter for text mode or math mode which absorbs spaces around the contents of a box.
% \begin{macrocode}
-\def\ytableau@ignorespaces{$}
+\def\skipin@YT{$}
+\def\skipout@YT{$}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
-% \begin{macro}{\ytableau@thisboxcolor}
+% \begin{macro}{\thisboxcolor@YT}
% Stores the color of the current box in a tableau. The color |clear| is not recognized by
% |xcolor| but denotes for us a transparent box.
-% Used in |\ytableau@@getcolor| and |\ytableau@endbox|.
+% Used in |\getcolor@@YT| and |\endbox@YT|.
% \begin{macrocode}
-\def\ytableau@thisboxcolor{clear}
+\def\thisboxcolor@YT{clear}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@centering}
+% \begin{macro}{\centering@YT}
% What kind of vertical alignment our tableaux will have.
% Used in |\ytableau| and options |aligntableaux|, |centertableaux|, |nocentertableaux|.
% \begin{macrocode}
-\def\ytableau@centering{top}
+\def\centering@YT{top}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@defarg}
+% \begin{macro}{\defarg@YT}
% The ``default optional argument'' which is applied to every tableau before all the others passed
% by the user. At the moment all it does is support option |smalltableaux|, but perhaps it can be
% put to greater use?
% Used in option |smalltableaux|.
% \begin{macrocode}
-\def\ytableau@defarg{}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\ytableau@tmpa}
-% \begin{macro}{\ytableau@tmpb}
-% Some temporary variables; I probably don't even have to reserve them.
-% Used in |\ytableau@compare|, |\ytableau@compare@|, |\ytableau@fullexpand|.
-% \begin{macrocode}
-\def\ytableau@tmpa{}
-\def\ytableau@tmpb{}
+\def\defarg@YT{}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\ytableau@tmpc}
-% Another temp variable, less widely used. Used in |\ytableau@fullexpand|.
-% \begin{macrocode}
-\def\ytableau@tmpc{}
-% \end{macrocode}
-% \end{macro}
+% \changes{v1.1}{2011/01/31}{Removed null initializations of temp macros \texttt{\textbackslash tmp(a,b,c)@YT}.}
%
-% \begin{macro}{\ytableau@compare}
+% \begin{macro}{\compare@YT}
% Compares two strings. Neither of them should be hidden in macros; i.e.\ it compares exactly what
% is given.
-% Used in options |boxsize| and |aligntableaux| as well as in |\ytableau@@getline|,
-% |\ytableau@@getentries|, |\ytableau@loop|, and |\ytableau@diagram@getentries|.
-% \begin{macro}{\ytableau@compare@}
+% Used in options |boxsize| and |aligntableaux| as well as in |\getline@@YT|,
+% |\getentries@@YT|, |\loop@YT|, and |\getnumbers@YT|.
+% \begin{macro}{\compare@@YT}
% Compares two strings, where the first is hidden in one layer of macros. Used in |\endytableau|,
-% |\ytableau@fcolorbox|.
-% \begin{macro}{\if@ytableau@eq}
-% Tests the result of |\ytableau@compare(@)|.
-% \begin{macrocode}
-\def\ytableau@compare#1#2{%
- \def\ytableau@tmpa{#1}\def\ytableau@tmpb{#2}%
- \ifx\ytableau@tmpa\ytableau@tmpb%
- \global\@ytableau@eqtrue%
+% |\fcolorbox@YT|.
+% \begin{macro}{\ifeq@YT}
+% Tests the result of |\compare@YT(@)|.
+% \begin{macrocode}
+\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
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -738,77 +790,72 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{boxsize}
+% \begin{option}{boxsize}
% Box size. Takes a dimension or |normal|.
% \begin{macrocode}
\define@key[ytableau]{setup}{boxsize}{%
% \end{macrocode}
% Make tableaux un-small before changing the box size, even if the user wants to go smaller,
-% because there is also the issue of |\ytableau@defarg| being set, and it is only ever changed in
+% because there is also the issue of |\defarg@YT| being set, and it is only ever changed in
% that option.
% \begin{macrocode}
\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%
}
% \end{macrocode}
-% \end{macro}
+% \end{option}
%
-% \begin{macro}{\aligntableaux}
+% \begin{option}{aligntableaux}
% Most general alignment option, can be any of |top|, |center|, or |bottom|.
-% \begin{macro}{centertableaux}
-% \begin{macro}{nocentertableaux}
+% \begin{option}{centertableaux}
+% \begin{option}{nocentertableaux}
% |centertableaux| is |aligntableaux = center|, \\
% |nocentertableaux| is |aligntableaux = top|.
% \begin{macrocode}
\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}%
}
% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
+% \end{option}
+% \end{option}
+% \end{option}
%
-% \begin{macro}{smalltableaux}
-% \begin{macro}{nosmalltableaux}
+% \begin{option}{smalltableaux}
+% \begin{option}{nosmalltableaux}
+% \changes{v1.1}{2011/01/31}{Correctly reassign a positive value to \texttt{\textbackslash boxdim@save@YT} when exiting small tableaux.}
% Small tableaux: reduce the box size and the text size.
% |nosmalltableaux| resets everything to the way it was before |smalltableaux| was passed.
% \begin{macrocode}
\define@boolkey[ytableau]{setup}{smalltableaux}[true]{%
\ifytableau@setup@smalltableaux%
% \end{macrocode}
-% This test guards against double-calling this option. Even if the user is not so malicious, this
-% can (does) happen in the \textsf{amsmath} display environments.
-% \begin{macrocode}
- \ifnum\ytableau@boxdim@save>0%
- \gdef\ytableau@defarg{\scriptstyle}%
-% \end{macrocode}
-% We use the sign of |\ytableau@boxdim@save| to indicate whether we are ``in'' small tableaux.
+% We use the sign of |\boxdim@save@YT| to indicate whether we are ``in'' small tableaux; this prevents double-calling the option. Even if the user is not so malicious, this can (does) happen in the \textsf{amsmath} display environments.
% \begin{macrocode}
- \global\ytableau@boxdim@save=-\ytableau@boxdim%
+ \ifnum\boxdim@save@YT>0%
+ \gdef\defarg@YT{\scriptstyle}%
+ \global\boxdim@save@YT=-\boxdim@YT%
% \end{macrocode}
% Arrived at by eyeballing. Exactly fits an |$f$|.
% \begin{macrocode}
- \global\ytableau@boxdim=.81em%
+ \global\boxdim@YT=.81em%
\fi%
\else%
-% \end{macrocode}
-% Another guard against double-calling.
-% \begin{macrocode}
- \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%
}
@@ -820,19 +867,20 @@
\fi%
}
% \end{macrocode}
-% \end{macro}
-% \end{macro}
+% \end{option}
+% \end{option}
%
-% \begin{macro}{textmode}
-% Requests that the boxes in tableaux be typeset in text mode rather than the default math mode.
-% \begin{macro}{mathmode}
-% Inverts |textmode|.
+% \begin{option}{textmode}
+% \begin{option}{mathmode}
+% Requests that the boxes in tableaux be typeset in text mode rather than the default math mode. In text mode, the |skipout| macro has to |\unskip| prior spaces, while the |skipin| macro has to ignore following ones.
% \begin{macrocode}
\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]{%
@@ -843,8 +891,8 @@
\fi%
}
% \end{macrocode}
-% \end{macro}
-% \end{macro}
+% \end{option}
+% \end{option}
%
% Now the default option, where one can ask \textsf{xcolor} for things.
% \begin{macrocode}
@@ -852,7 +900,7 @@
% \end{macrocode}
%
% Process the options now. We don't really need to be so specific but it doesn't hurt. Then we
-% load xcolor with the options we may have collected.
+% load \textsf{xcolor} with the options we may have collected.
% \begin{macrocode}
\ProcessOptionsX[ytableau]<setup>[]
\RequirePackage{xcolor}
@@ -867,39 +915,42 @@
% \begin{macrocode}
\newenvironment{ytableau}[1][]
{%
- \leavevmode%
-% \end{macrocode}
-% The point of this obtuse command is to produce a syntactically balanced pair of braces |{}| which
-% semantically is equivalent to just an open brace |{|. This is required to support tableaux nested
-% inside other alignments because |\halign| does not recognize |\bgroup|...|\egroup| as designating
-% a nesting! (We will use this fact later, actually.) But we can't just write |{| and (in
-% |\endytableau|) |}| either.
-% \begin{macrocode}
- {\iffalse}\fi%
- \global\setbox\ytableau@thistableau=\hbox\bgroup$%
- \m@th%
- \setlength{\fboxrule}{\ytableau@boxframe}%
- \setlength{\fboxsep}{0pt}%
% \end{macrocode}
+% \changes{v1.1}{2010/11/10}{Removed an unnecessary layer of boxes and moved the fake braces into
+% the outer layer.}
% Despite the alignment requirements, we set the tableau top-aligned so that it can be easily
% chained. This will get fixed before we print it, though.
+%
+% The point of the mysterious |\iffalse| is to produce a syntactically balanced pair of braces |{}|
+% which semantically is equivalent to just an open brace |{|. This is required to support tableaux
+% nested inside other alignments because |\halign| does not recognize |\bgroup|...|\egroup| as
+% designating a nesting! (We will use this fact later, actually.) But we can't just write |{| and
+% (in |\endytableau|) |}| either.
% \begin{macrocode}
- \vtop\bgroup%
+ \global\setbox\thistableau@YT=\vtop{\iffalse}\fi%
+ \setlength{\fboxrule}{\boxframe@YT}%
+ \setlength{\fboxsep}{0pt}%
% \end{macrocode}
% I hate |\cr|, let's use the \LaTeX\ convention.
% \begin{macrocode}
- \let\\=\ytableau@cr%
+ \let\\=\cr@YT%
% \end{macrocode}
% Lines and columns should abut, accounting for the fact that each entry is framed.
% \begin{macrocode}
- \offinterlineskip%
- \openup-\fboxrule%
- \tabskip=-\fboxrule%
+ \offinterlineskip%
+ \openup-\fboxrule%
+ \tabskip=-\fboxrule%
+% \end{macrocode}
+ % \changes{v1.1}{2010/11/10}{Added the everycr fix.}
+% We have to make sure |\everycr| is empty or else strange things could happen (like in the
+% \textsf{amsmath} environment |gather|). Thanks to Harald Hanche-Olsen for telling me about this.
+% \begin{macrocode}
+ \everycr={}%
% \end{macrocode}
% Now we begin the |\halign|. Each entry is passed as an argument to our box-building function,
-% but we can't just write something like |\ytableau@box{##}| because of the following complication:
+% but we can't just write something like |\box@YT{##}| because of the following complication:
%
-% When TeX sees |\ytableau@box{|, it absorbs tokens up until the next unmatched |}| without
+% When TeX sees |\box@YT{|, it absorbs tokens up until the next unmatched |}| without
% interpreting them and then feeds that to the macro as |#1|. Unfortunately, we would like it to
% be possible to omit |\\| on the last line (as people are used to this, and Knuth provided for it
% with |\crcr|). But since |ytableau| is an environment, the ending of |\halign| is hidden in the
@@ -907,80 +958,71 @@
% reading for |##| in the proposed code.
%
% The workaround is to pretend that |##| is not an argument to a macro until we get deep inside
-% |\ytableau@startbox|, where (after some processing) it is fed to an |\hbox| inside math mode.
+% |\startbox@YT|, where (after some processing) it is fed to an |\hbox| inside math mode.
% |\hbox| is not really a macro (it's a builtin) and it does interpret its contents as it reads
% them, and since we have finally set up the desired typesetting environment we can let it read
% |##| properly. Since we are \emph{still} inside an |\halign|, eventually it will expand
% |\endytableau| and |##| will terminate properly. Whew.
% \begin{macrocode}
- \halign\bgroup&\ytableau@startbox{\ytableau@defarg}{#1}##%
- \ytableau@endbox\cr%
+ \halign\bgroup&\startbox@YT{\defarg@YT}{#1}##%
+ \endbox@YT\cr%
}
{%
% \end{macrocode}
% The |\crcr| supports the omission of |\\| in the last row. That's a pretty modest goal for all
% the work that went into thinking up this crazy scheme.
-% The following delimiters close, respectively, |\halign|, |\ytableau@centering|, |\hbox|, and the
-% |{| which protects the |\halign| in case the tableau finds itself in another alignment.
% \begin{macrocode}
- \crcr\egroup%
- \egroup%
- $\egroup%
- \iffalse{\fi}%
+ \crcr\egroup%
+ \iffalse{\fi}%
% \end{macrocode}
% Support for chaining. We allow |\endytableau| to be followed by |*[...]{...}|, which is fed to
% |\ydiagram| as-is. This only works in the short forms |\ytableaushort| and |\ydiagram|, since in
% |\end{ytableau}| there is extra code intervening before the following characters and no way to
% insert things in it.
+% \changes{v1.1}{2010/11/10}{Save the box width difference rather than the larger width.}
% \begin{macrocode}
- \ifnum\wd\ytableau@thistableau>\wd\ytableau@tableaux%
- \ytableau@tableauwd=\wd\ytableau@thistableau%
+ \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%
% \end{macrocode}
-% We have saved the larger width, but now |\ytableau@thistableau| must have width zero so that it
+% We have saved the larger width, but now |\thistableau@YT| must have width zero so that it
% can be overlaid with the existing tableaux.
+% \changes{v1.1}{2010/11/10}{Replaced explicit setting of the chained box width by a kern.}
% \begin{macrocode}
- \wd\ytableau@thistableau=0pt%
- \setbox\ytableau@tableaux%
- =\hbox{\box\ytableau@thistableau\unhbox\ytableau@tableaux}%
-% \end{macrocode}
-% Now we set the width to what it should be.
-% \begin{macrocode}
- \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%
- \fi%
% \end{macrocode}
-% The other two alignments are straightforward, but to get |top| requires some work when we are
-% surrounded by \textsf{amsmath}'s |align| or |gather|. For some reason, my boxes didn't work as
-% expected there.
-% \begin{macrocode}
- \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%
+% \changes{v1.1}{2010/11/10}{Moved the leavevmode down to the output routine and simplified the alignment computations now that the everycr fix is in.}
+% We adjust the vertical alignment finally and print the boxes. |\leavevmode| ensures that the
+% tableau is treated in horizontal mode. You are on your own if you put this inside of another box.
+% \begin{macrocode}
+ \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%
+ \box\tableaux@YT%
\fi%
}%
}
% \end{macrocode}
% \end{environment}
%
-% \begin{macro}{\ytableau@cr}
+% \begin{macro}{\cr@YT}
% Annoying to have to do this, but nested halign chokes when |\cr| appears inside the definition.
% \begin{macrocode}
-\def\ytableau@cr{\cr}
+\def\cr@YT{\cr}
% \end{macrocode}
% \end{macro}
%
@@ -990,87 +1032,90 @@
% omitting the box). To support the optional argument without screwing up the |\omit|, we have to
% go in two steps.
% \begin{macrocode}
-\def\none{\omit\ytableau@none}
+\def\none{\omit\none@YT}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@none}
+% \begin{macro}{\none@YT}
% This finds the optional argument to |\none| and makes the box itself. We draw an invisible frame
% by replacing the actual frame with the frame separation. We also use |\ignorespaces| to eat up
% any spaces that occur after |\none|; in a normal box, they would be chopped in math mode.
% \begin{macrocode}
-\newcommand{\ytableau@none}[1][]{%
- \def\ytableau@thisboxcolor{clear}%
- \setlength{\fboxsep}{\ytableau@boxframe}%
+\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%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@startbox}
+% \begin{macro}{\startbox@YT}
% |#1| = general formatting, |#2| = specific formatting.
-% We want to extract the colors from each and then pass the whole thing on to |\ytableau@@startbox|.
+% We want to extract the colors from each and then pass the whole thing on to |\startbox@@YT|.
% \begin{macrocode}
-\def\ytableau@startbox#1#2{%
+\def\startbox@YT#1#2{%
% \end{macrocode}
% We get the colors and then put the rest into temporary token registers.
% \begin{macrocode}
- \ytableau@getcolor{\ytableau@save{\ytableau@opttoksa}}#1\@nil%
- \ytableau@getcolor{\ytableau@save{\ytableau@opttoksb}}#2\@nil%
+ \getcolor@YT{\save@YT{\opttoksa@YT}}#1\@nil%
+ \getcolor@YT{\save@YT{\opttoksb@YT}}#2\@nil%
% \end{macrocode}
% Now we get the color from the entry and proceed.
% \begin{macrocode}
- \ytableau@getcolor%
- {\ytableau@@startbox\the\ytableau@opttoksa\the\ytableau@opttoksb}%
+ \getcolor@YT%
+ {\startbox@@YT\the\opttoksa@YT\the\opttoksb@YT}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@save}
+% \begin{macro}{\save@YT}
% Stick the following text into the token register in |#1|. Note that we use |\@nil| as an
% end-marker; it is not actually defined, so hopefully we never expand it!
% \begin{macrocode}
-\def\ytableau@save#1#2\@nil{#1={#2}}
+\def\save@YT#1#2\@nil{#1={#2}}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@getcolor}
+% \begin{macro}{\getcolor@YT}
% |#1| is pasted in front of what remains after removing the color. Basically, it's a ``do next''.
% \begin{macrocode}
-\def\ytableau@getcolor#1{\ytableau@ifstar{\ytableau@@getcolor{#1}}{#1}}
+\def\getcolor@YT#1{\ifstar@YT{\getcolor@@YT{#1}}{#1}}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@@getcolor}
-% Save the (optional) color argument and pass the rest to |\ytableau@@startbox|.
+% \begin{macro}{\getcolor@@YT}
+% Save the (optional) color argument and pass the rest to |\startbox@@YT|.
% \begin{macrocode}
-\def\ytableau@@getcolor#1(#2){%
- \def\ytableau@thisboxcolor{#2}%
+\def\getcolor@@YT#1(#2){%
+ \def\thisboxcolor@YT{#2}%
#1%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@@startbox}
+% \begin{macro}{\startbox@@YT}
% Start collecting the current entry into a horizontally-centered hbox, but save the result.
% \begin{macrocode}
-\def\ytableau@@startbox{%
+\def\startbox@@YT{%
% \end{macrocode}
% Use a |\bgroup|...|\egroup| so as not to introduce nesting that would block |&| or |\cr|.
% \begin{macrocode}
- \setbox\ytableau@thisbox=\hbox to \ytableau@boxdim\bgroup%
+ \setbox\thisbox@YT=\hbox to \boxdim@YT\bgroup%
\hss%
- \ytableau@ignorespaces%
+ \skipin@YT%
}
% \end{macrocode}
% Since we are now in the intended typesetting context (i.e. an hbox with math mode on)
% we can let |\halign| expand tokens in the rest of the entry until it finds a |&| or |\cr| (= |\\|)
-% Then we finish the box and set it.
+% \end{macro}
+%
+% \begin{macro}{\endbox@YT}
+% Now we can finish the box and set it.
% \begin{macrocode}
-\def\ytableau@endbox{%
- \ytableau@ignorespaces%
+\def\endbox@YT{%
+ \skipout@YT%
\hss%
\egroup%
% \end{macrocode}
@@ -1078,24 +1123,24 @@
% Multiple text lines will be aligned with the baseline of the last line at the center, so this
% really only works well for single lines of text.
% \begin{macrocode}
- \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}%
}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@fcolorbox}
+% \begin{macro}{\fcolorbox@YT}
% We need a wrapper around |\fcolorbox| since it produces an opaque box, and sometimes, we want
% |clear|.
%
% |#1| = color, |#2| = contents
% \begin{macrocode}
-\def\ytableau@fcolorbox#1#2{%
- \ytableau@compare@{#1}{clear}%
- \if@ytableau@eq%
+\def\fcolorbox@YT#1#2{%
+ \compare@@YT{#1}{clear}%
+ \ifeq@YT%
% \end{macrocode}
% Clear background; don't draw anything.
% \begin{macrocode}
@@ -1119,93 +1164,93 @@
% \begin{macrocode}
\newcommand{\ytableaushort}[2][]{%
% \end{macrocode}
-% |\endytableau| has to be right at the end, so we can't use scope to reset |\ytableau@toks|.
+% |\endytableau| has to be right at the end, so we can't use scope to reset |\toks@YT|.
% \begin{macrocode}
- \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%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@getentries}
+% \begin{macro}{\getentries@YT}
% Split the CSV into rows. This is really a job for |etoolbox:\docsvlist| but whatever.
% We put a |.| in front of the string so that a line may be enclosed entirely in |{...}|
% Otherwise, |\def\cs#1,{etc}| would make |#1| = |...| and not |#1| = |{...}| as we want.
% \begin{macrocode}
-\def\ytableau@getentries#1#2{\ytableau@getline{#1}{#2}.}
+\def\getentries@YT#1#2{\getline@YT{#1}{#2}.}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@getline}
+% \begin{macro}{\getline@YT}
% Grab the first \meta{line}|,| in the string and remove the initial |.|
% \begin{macrocode}
-\def\ytableau@getline#1#2#3,{%
- \ytableau@opttoksa=\expandafter{\@gobble#3}%
- \ytableau@opttoksb={\ytableau@@getline{#1}{#2}}%
+\def\getline@YT#1#2#3,{%
+ \opttoksa@YT=\expandafter{\@gobble#3}%
+ \opttoksb@YT={\getline@@YT{#1}{#2}}%
% \end{macrocode}
-% We pass |#3| back as an \emph{argument} to |\ytableau@@getline|, thus avoiding the braces issue.
+% We pass |#3| back as an \emph{argument} to |\getline@@YT|, thus avoiding the braces issue.
% \begin{macrocode}
- \edef\ytableau@next{\the\ytableau@opttoksb{\the\ytableau@opttoksa}}%
- \ytableau@next%
+ \edef\next@YT{\the\opttoksb@YT{\the\opttoksa@YT}}%
+ \next@YT%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@@getline}
+% \begin{macro}{\getline@@YT}
% |#1| = the macro to process each row,
% |#2| = the junk to put after each row (followed by |\@nil|),
% |#3| = everything before the first comma,
% |#4| = the token after the first comma (possibly another comma).
% \begin{macrocode}
-\def\ytableau@@getline#1#2#3#4{%
+\def\getline@@YT#1#2#3#4{%
% \end{macrocode}
% Handle double commas or trailing commas.
% \begin{macrocode}
- \ytableau@compare{#4}{,}%
- \if@ytableau@eq%
+ \compare@YT{#4}{,}%
+ \ifeq@YT%
% \end{macrocode}
% Try again.
% \begin{macrocode}
- \def\ytableau@next{\ytableau@@getline{#1}{#2}{#3}}%
+ \def\next@YT{\getline@@YT{#1}{#2}{#3}}%
\else%
% \end{macrocode}
% If this is not the last row, we have to recurse down the list. Otherwise, just process the
% current row.
% \begin{macrocode}
- \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%
% \end{macrocode}
% |#4| is a single token, so it should be replaced as one. Note that this adds braces; we will
-% have to correct for this all the way down in |\ytableau@fullexpand| when we don't want them.
+% have to correct for this all the way down in |\fullexpand@YT| when we don't want them.
% \begin{macrocode}
- \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%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@@getentries}
+% \begin{macro}{\getentries@@YT}
% Separates the entries in a line of |\ytableaushort| and reformats them for |\ytableau|.
% Takes two tokens and checks if the second is |\@nil|, which means the first is the last entry.
% \begin{macrocode}
-\def\ytableau@@getentries#1#2{%
+\def\getentries@@YT#1#2{%
% \end{macrocode}
% If this is not the last entry, we have to recurse down the line. Otherwise, we just print |\\|.
% \begin{macrocode}
- \ytableau@compare{#2}{\@nil}%
- \if@ytableau@eq%
- \ytableau@toks=\expandafter{\the\ytableau@toks#1\\}%
- \def\ytableau@next{}%
+ \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%
}
% \end{macrocode}
% \end{macro}
@@ -1222,90 +1267,90 @@
% \begin{macrocode}
\newcommand\ydiagram[2][]{%
% \end{macrocode}
-% We need |\endytableau| to be right at the end, so we can't use scope to reset |\ytableau@toks|.
+% We need |\endytableau| to be right at the end, so we can't use scope to reset |\toks@YT|.
% \begin{macrocode}
- \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%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@diagram@getentries}
+% \begin{macro}{\getnumbers@YT}
% Separates the entries in a line of |\ydiagram| and reformats them for |\ytableau|.
% \begin{macrocode}
-\def\ytableau@diagram@getentries#1+#2\@nil{%
+\def\getnumbers@YT#1+#2\@nil{%
% \end{macrocode}
% If |#2| = |{}|, then there is no offset and |#1| is the row shape.
% \begin{macrocode}
- \ytableau@compare{#2}{}%
- \if@ytableau@eq%
- \def\ytableau@next{%
- \ytableau@loop{#1}{}%
+ \compare@YT{#2}{}%
+ \ifeq@YT%
+ \def\next@YT{%
+ \loop@YT{#1}{}%
}%
% \end{macrocode}
% Else |#1| is the offset and |#2| is the shape.
% \begin{macrocode}
\else%
- \def\ytableau@next{%
- \ytableau@loop{#1}{\none}%
+ \def\next@YT{%
+ \loop@YT{#1}{\none}%
% \end{macrocode}
% Now |#2| looks like \meta{number}|+|, so we feed it back in.
% \begin{macrocode}
- \ytableau@diagram@getentries#2\@nil%
+ \getnumbers@YT#2\@nil%
}%
\fi%
- \ytableau@next%
+ \next@YT%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@loop}
+% \begin{macro}{\loop@YT}
% Loops on the first argument, building a |\ytableau| line whose entries are the second argument.
-% The results go in |\ytableau@toks|.
+% The results go in |\toks@YT|.
% \begin{macrocode}
-\def\ytableau@loop#1#2{%
+\def\loop@YT#1#2{%
% \end{macrocode}
-% Fills |\ytableau@diagram@count|.
+% Fills |\count@YT|.
% \begin{macrocode}
- \ytableau@fullexpand{#1}%
- \loop\ifnum\ytableau@diagram@count>1%
- \ytableau@toks=\expandafter{\the\ytableau@toks#2&}%
- \advance\ytableau@diagram@count by -1%
+ \fullexpand@YT{#1}%
+ \loop\ifnum\count@YT>1%
+ \toks@YT=\expandafter{\the\toks@YT#2&}%
+ \advance\count@YT by -1%
\repeat%
% \end{macrocode}
% The last entry in the list may not be the last entry in the line. If it's empty, it is (according
% to our usage), otherwise not.
% \begin{macrocode}
- \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%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ytableau@fullexpand}
+% \begin{macro}{\fullexpand@YT}
% Fully expand its argument. Hopefully you passed an argument for which that makes sense.
% This also strips braces.
% \begin{macrocode}
-\def\ytableau@fullexpand#1{%
+\def\fullexpand@YT#1{%
% \end{macrocode}
% TeX's brace parser will strip the braces for us.
% \begin{macrocode}
- \def\ytableau@tmpa##1{##1}%
+ \def\tmpa@YT##1{##1}%
% \end{macrocode}
% Turns e.g.\ both |#1| = |{23}| and |#1| = |23| into |23|.
% As a side effect, e.g.\ if |#1| = |{2}3|, the result is |23|.
% However, |#1| = |2{3}| stays that way, so is probably an error.
% \begin{macrocode}
- \edef\ytableau@tmpb{\ytableau@tmpa#1}%
- \edef\ytableau@tmpc{\ytableau@tmpb}%
- \ytableau@diagram@count=\ytableau@tmpc%
+ \edef\tmpb@YT{\tmpa@YT#1}%
+ \edef\tmpc@YT{\tmpb@YT}%
+ \count@YT=\tmpc@YT%
}
% \end{macrocode}
% \end{macro}
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
%%