From 48b56d799036b3732d15096eff82a9c1788f252f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 14 Jul 2012 16:20:20 +0000 Subject: ytableau (20jun12) git-svn-id: svn://tug.org/texlive/trunk@27044 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/ytableau/README | 16 +- Master/texmf-dist/doc/latex/ytableau/ytableau.pdf | Bin 420761 -> 352629 bytes .../texmf-dist/source/latex/ytableau/ytableau.dtx | 739 ++++++++++++--------- .../texmf-dist/source/latex/ytableau/ytableau.ins | 2 +- Master/texmf-dist/tex/latex/ytableau/ytableau.sty | 361 +++++----- 5 files changed, 642 insertions(+), 476 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/ytableau/README b/Master/texmf-dist/doc/latex/ytableau/README index 3f66d0aab3c..681a2b2012b 100644 --- a/Master/texmf-dist/doc/latex/ytableau/README +++ b/Master/texmf-dist/doc/latex/ytableau/README @@ -27,11 +27,19 @@ Run: > latex ytableau.ins -to get the .sty file, and if you like, also run +to get ytableau.sty, and if you like, also run > latex ytableau.dtx -to get the documentation, which includes some code samples -(and the commented source). +to get the ytableau.dvi (or pdflatex to get ytableau.pdf), which +includes some code samples (and the commented source). This should +have been distributed with this README. -Both of these derived files should have come with this README. +To regenerate the index and the changelog, after running the above +commands, you should do: + +> makeindex -s gind.ist -o ytableau.ind ytableau.idx +> makeindex -s gglo.ist -o ytableau.gls ytableau.glo + +and then compile ytableau.dtx again (possibly several times to get the +cross-references correct). \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/ytableau/ytableau.pdf b/Master/texmf-dist/doc/latex/ytableau/ytableau.pdf index b4183342fd6..548e4c53f95 100644 Binary files a/Master/texmf-dist/doc/latex/ytableau/ytableau.pdf and b/Master/texmf-dist/doc/latex/ytableau/ytableau.pdf differ diff --git a/Master/texmf-dist/source/latex/ytableau/ytableau.dtx b/Master/texmf-dist/source/latex/ytableau/ytableau.dtx index f5b4f3c85b9..15f859913c4 100644 --- a/Master/texmf-dist/source/latex/ytableau/ytableau.dtx +++ b/Master/texmf-dist/source/latex/ytableau/ytableau.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2010 by Ryan Reich +% Copyright (C) 2010--2012 by Ryan Reich % ------------------------------------------------------- % % This file may be distributed and/or modified under the @@ -18,7 +18,7 @@ % \iffalse %\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] % %<*driver> \documentclass{ltxdoc} @@ -84,21 +84,21 @@ \CodelineIndex \RecordChanges \begin{document} - \DocInput{ytableau.dtx} + \DocInput{ytableau.dtx} \newlength{\newleftmargin} \setlength{\newleftmargin}{\marginparwidth} \addtolength{\newleftmargin}{-0.5in} \newpage -\begin{adjustwidth}{-\newleftmargin}{-0.5in} - \PrintChanges - \newpage + \begin{adjustwidth}{-\newleftmargin}{-0.5in} + \PrintChanges + \newpage \PrintIndex \end{adjustwidth} \end{document} % % \fi % -% \CheckSum{471} +% \CheckSum{497} % % \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 @@ -124,28 +124,30 @@ % \DoNotIndex{\@firstoftwo,\@gobble,\eq@YTfalse,\eq@YTtrue} % \DoNotIndex{\advance} % \DoNotIndex{\bgroup,\box} -% \DoNotIndex{\crcr,\CurrentOption} -% \DoNotIndex{\DeclareOptionX, \def,\define@boolkey,\define@choicekey,\define@key,\dp} -% \DoNotIndex{\edef,\egroup,\else,\expandafter} -% \DoNotIndex{\fi} +% \DoNotIndex{\cr,\crcr} +% \DoNotIndex{\def,\dimexpr,\dp} +% \DoNotIndex{\edef,\egroup,\else,\everycr,\expandafter} +% \DoNotIndex{\fbox,\fboxrule,\fboxsep,\fcolorbox,\fi} % \DoNotIndex{\gdef,\global} -% \DoNotIndex{\hbox,\hss,\ht} -% \DoNotIndex{\ifnum,\ifx,\ifytableau@setup@nosmalltableaux,\ifytableau@setup@smalltableaux} -% \DoNotIndex{\ifytableau@setup@mathmode,\ifytableau@setup@textmode} +% \DoNotIndex{\halign,\hbox,\hss,\ht} +% \DoNotIndex{\iffalse,\ifnum,\ifx,\ignorespaces} +% \DoNotIndex{\kern} % \DoNotIndex{\leavevmode,\let,\loop} -% \DoNotIndex{\m@th} % \DoNotIndex{\newbox,\newcommand,\newcount,\newdimen,\newenvironment,\newif,\newtoks} -% \DoNotIndex{\PassOptionsToPackage,\ProcessOptionsX} -% \DoNotIndex{\repeat} -% \DoNotIndex{\scriptscriptstyle,\scriptstyle,\setbox,\setkeys,\setlength} -% \DoNotIndex{\the} -% \DoNotIndex{\unhbox} +% \DoNotIndex{\offinterlineskip,\omit,\openup} +% \DoNotIndex{\pgfkeys,\pgfkeysalso,\ProcessPgfPackageOptions} +% \DoNotIndex{\raise,\relax,\repeat} +% \DoNotIndex{\scriptscriptstyle,\scriptsize,\scriptstyle,\setbox,\setlength} +% \DoNotIndex{\tabskip,\the} +% \DoNotIndex{\unexpanded,\unhbox,\unskip} % \DoNotIndex{\vbox,\vcenter,\vrule,\vss,\vtop} % \DoNotIndex{\wd} +% \DoNotIndex{\xdef} % % \title{The \textsf{ytableau} package\thanks{This document describes % \textsf{ytableau}~\fileversion, dated~\filedate.}} % \author{Ryan Reich\\\texttt{ryan.reich@gmail.com}} +% \date{June 17, 2012} % \maketitle % % \tableofcontents @@ -239,8 +241,12 @@ % are horizontally and (mostly) vertically % centered in their box. In fact, the entries are treated as though they consist of a single line % of text, and the baselines of all the entries in a row are aligned with each other for a -% consistent appearance. The environment may appear in or out of math mode without any ill effect -% (and without any effect on the contents). +% consistent appearance (but see the options). + +% The environment may appear in or out of math mode without any ill effect +% (and without any effect on the contents). However, it \emph{is} affected by the ambient font +% size: in |\Huge| text the entire tableau is correspondingly Huge, at least as long as you are +% careful to specify the box size in |em| or |ex| units, rather than invariant ones like |pt|. % % \DescribeMacro{\none} % An entry may be omitted by writing |\none|, which prevents the drawing of a frame but places an @@ -290,7 +296,7 @@ % |\ydiagram{2 + 1, 3, 1}|. % \end{center} % Both \meta{offset} and \meta{number} may be any -% \TeX\ expressions evaluating to the textual representation of a number (e.g.\ 6 or +% \TeX\ expressions evaluating to the textual representation of a number, including zero (e.g.\ 6 or % |\thecountername|, but not just |\countername|). The boxes can be colored or filled with a single % expression by means of \meta{general formatting}. % @@ -330,9 +336,9 @@ % % \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. +% indeed, just small enough to fit a |$($| precisely. 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, as do |smalltableaux=false| and |smalltableaux=off|. % % \item \DescribeOption{aligntableaux} \DescribeOption{centertableaux} % \DescribeOption{nocentertableaux} @@ -346,6 +352,13 @@ % \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). +% +% \item \DescribeOption{baseline} \DescribeOption{nobaseline} \DescribeOption{centerboxes} +% |baseline|/|nobaseline|/|centerboxes|. The former, which is the default, aligns the +% entries of each box so that they share a common baseline, like normal text (but +% are otherwise centered). The latter (which are synonyms) center them vertically and +% independently of each other. Use |nobaseline| for tableaux with numbers, but |baseline| for +% anything else, particularly anything with some depth. % \end{itemize} % It may not be useful to set these options globally, so we provide a macro for changing each of % these parameters ``on the fly'': @@ -353,9 +366,6 @@ % \DescribeMacro{\ytableausetup} % Takes all of the above options and acts on them, setting parameters for all subsequent % tableaux. The assignments are global with respect to \TeX\ nestings. -% -% One can also pass options to \textsf{xcolor} when calling \textsf{ytableau}, but these options -% are not further configurable through |\ytableausetup|. % % \section{Samples} % @@ -462,12 +472,21 @@ % 12, % 2} % \hfill +% \ytableausetup{nobaseline} +% \ytableaushort{ +% \none\none 12, +% \none 12, +% 12, +% 2} +% \hfill % \begin{minipage}{0.5\textwidth} % \begin{verbatim} % \ytableausetup{smalltableaux} % \ytableaushort{ -% \none\none 12, -% \none 12, 12, 2} +% \none\none12,\none12,12,2} +% \ytableausetup{nobaseline} +% \ytableaushort{ +% \none\none12,\none12,12,2} % \end{verbatim} % \end{minipage} % \end{center} @@ -475,9 +494,12 @@ % \begin{center} % \ydiagram{2+2,1+2,2,1} % \hfill +% \ydiagram{2+2,0,0+2,1} +% \hfill % \begin{minipage}{0.5\textwidth} % \begin{verbatim} % \ydiagram{2+2,1+2,2,1} +% \ydiagram{2+2,0,0+2,1} % \end{verbatim} % \end{minipage} % \end{center} @@ -485,7 +507,7 @@ % \subsection{Color and chaining} % % \begin{center} -% \ytableausetup{nosmalltableaux} +% \ytableausetup{nosmalltableaux,nobaseline} % \begin{ytableau} % *(red) 1 & *(red) 3 & *(red) 5 \\ % *(blue) 2 & *(blue) 4 \\ @@ -505,13 +527,24 @@ % \end{center} % % \begin{center} +% \ytableausetup{baseline} % \ytableaushort[*(green) x_] % {135,{*(white)2}4,6} % \hfill +% {\Large +% \ytableaushort[*(green) x_] +% {135,{*(white)2}4,6} +% } +% \hfill % \begin{minipage}{0.5\textwidth} % \begin{verbatim} +% \ytableausetup{baseline} % \ytableaushort[*(green) x_] % {135,{*(white)2}4,6} +% {\Large +% \ytableaushort[*(green) x_] +% {135,{*(white)2}4,6} +% } % \end{verbatim} % \end{minipage} % \end{center} @@ -580,9 +613,11 @@ % \end{center} % % \StopEventually{} -% +% \newpage % \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.} +% \changes{v1.2}{2012/06/17}{Removed a lot of pointless endline-comments after control sequences and added spaces after numbers.} +% \changes{v1.2}{2012/06/17}{Fixed a bug where the prevailing font size was ignored or imperfectly obeyed.} % % \subsection{Global defintions} % @@ -593,7 +628,7 @@ % \begin{macro}{\tableaux@YT} % When chaining, collects the successive tableaux. % \begin{macro}{\thistableau@YT} -% When chaining, stores the current tableaux in the chain. +% When chaining, stores the current tableau in the chain. % \\ % Used in |\endytableau|. % \begin{macrocode} @@ -613,11 +648,10 @@ % % \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 |\endbox@YT|. +% \changes{v1.2}{2012/06/17}{Moved definition to \texttt{\textbackslash ytableau}} +% Box that holds the reference-height and -depth character, which should be a math-mode parenthesis. This is set in |\ytableau| and used in option |smalltableaux| and in |\endbox@YT|. % \begin{macrocode} \newbox\refhtdp@YT - \setbox\refhtdp@YT=\hbox{$bg$} % \end{macrocode} % \end{macro} % @@ -646,26 +680,11 @@ % % \subsubsection{Dimension registers} % -% \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\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}{\boxdim@YT} % The size of the boxes in a tableau. -% Used in |\none|, |\start@@YT|, |\end@YT|. +% Used in |\ytableau|, |\startbox@@YT|, |\endbox@YT|. % \begin{macrocode} \newdimen\boxdim@YT - \boxdim@YT=\boxdim@normal@YT % \end{macrocode} % \end{macro} % @@ -677,13 +696,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\boxframe@YT} -% The width of the frame in a tableau. Used in |\ytableau| and |\endytableau|. -% \begin{macrocode} -\newdimen\boxframe@YT \boxframe@YT=0.4pt -% \end{macrocode} -% \end{macro} -% % \subsubsection{Count registers} % % \begin{macro}{\count@YT} @@ -702,17 +714,100 @@ \def\ifstar@YT#1{\kernel@ifnextchar *{\@firstoftwo{#1}}} % \end{macrocode} % \end{macro} +% +% \begin{macro}{\expandonce@YT} +% \changes{v1.2}{2012/06/17}{Added.} +% This is a substitute for using all of \textsf{etoolbox}. It operates on one token. +% \begin{macrocode} +\def\expandonce@YT#1{% + \expandafter\unexpanded\expandafter{#1}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\nil@YT} +% \changes{v1.2}{2012/06/17}{Added.} +% A useful marker; it is equal to itself both as text and as a macro. +% \begin{macrocode} +\def\nil@YT{\nil@YT} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\boxframe@YT} +% \changes{v1.2}{2012/06/17}{Made a macro.} +% The font-independent width of the frame in a tableau. Used in |\ytableau| and |\none@YT|. +% \begin{macrocode} +\def\boxframe@YT{0.04em} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\boxdim@normal@YT} +% \changes{v1.2}{2012/06/17}{Made a macro.} +% \begin{macro}{\boxdim@save@YT} +% \changes{v1.2}{2012/06/17}{Made a macro.} +% Respectively, the font-independent "normal" box size and the previously used size when using the option pair |smalltableaux|, |nosmalltableaux|. +% Used in options |boxsize|, |smalltableaux|, |nosmalltableaux|. +% \begin{macrocode} +\def\boxdim@normal@YT{1.5em} +\let\boxdim@save@YT = \boxdim@normal@YT +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\macro@boxdim@YT} +% \changes{v1.2}{2012/06/17}{Added.} +% The font-independent dimension of a tableau box. Sometimes is a |\dimexpr|. Used in options |boxsize|, |smalltableaux|, |nosmalltableaux|, and in |\ytableau|. +% \begin{macrocode} +\edef\macro@boxdim@YT{\boxdim@normal@YT} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\font@YT} +% \changes{v1.2}{2012/06/17}{Changed name from \texttt{\textbackslash defarg@YT}.} +% This is the font style of everything in a tableau box. By default, it is normal. +% Used in option |smalltableaux|. +% \begin{macrocode} +\def\font@YT{} +% \end{macrocode} +% \end{macro} % % \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\skipin@YT{$} -\def\skipout@YT{$} +% \begin{macro}{\smallfont@YT} +% \changes{v1.2}{2012/06/17}{Added.} +% The font style for the |smalltableaux| option. It depends on math or text mode. +% \begin{macro}{\set@mathmode@YT} +% \changes{v1.2}{2012/06/17}{Added.} +% This sets up the tableau boxes to typeset in math mode. +% \begin{macrocode} +\def\set@mathmode@YT{% + \gdef\skipin@YT{$}% + \gdef\skipout@YT{$}% + \def\smallfont@YT{\scriptstyle}% +} % \end{macrocode} % \end{macro} +% \begin{macro}{\set@textmode@YT} +% \changes{v1.2}{2012/06/17}{Added.} +% This sets up the tableau boxes to typset in text mode. +% In text mode, the |skipout| macro has to |\unskip| prior spaces, while the |skipin| macro has to ignore following ones. +% \begin{macrocode} +\def\set@textmode@YT{% + \gdef\skipin@YT{\ignorespaces}% + \gdef\skipout@YT{\unskip}% + \def\smallfont@YT{\scriptsize}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} % \end{macro} +% The default is math mode. +% \begin{macrocode} +\set@mathmode@YT +% \end{macrocode} % % \begin{macro}{\thisboxcolor@YT} % Stores the color of the current box in a tableau. The color |clear| is not recognized by @@ -731,16 +826,6 @@ % \end{macrocode} % \end{macro} % -% \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\defarg@YT{} -% \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}{\compare@YT} @@ -756,19 +841,19 @@ % \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\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 % \end{macrocode} @@ -777,136 +862,187 @@ % \end{macro} % % \subsection{Options} +% \changes{v1.2}{2012/06/17}{Added an option \texttt{baseline} to fix an irritating irregularity in some tableaux.} +% \changes{v1.2}{2012/06/17}{Switched from using \textsf{xkeyval} to \textsf{pgfkeys}.} % -% We include |xkeyval| to support various options. +% We include \textsf{pgfkeys} to support various options. % \begin{macrocode} -\RequirePackage{xkeyval} +\RequirePackage{pgfkeys} +\pgfkeys{/ytableau/options/.is family} % \end{macrocode} % % \begin{macro}{\ytableausetup} % The user interface to options once the document is in progress. +% \end{macro} % \begin{macrocode} -\newcommand{\ytableausetup}[1]{\setkeys[ytableau]{setup}{#1}} +\newcommand{\ytableausetup}[1]{\pgfkeys{/ytableau/options,#1}} +\pgfkeys{/ytableau/options, % \end{macrocode} -% \end{macro} -% % \begin{option}{boxsize} % Box size. Takes a dimension or |normal|. +% \end{option} % \begin{macrocode} -\define@key[ytableau]{setup}{boxsize}{% + boxsize/.value required, + boxsize/.code = {% % \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 |\defarg@YT| being set, and it is only ever changed in +% because there is also the issue of |\font@YT| being set, and it is only ever changed in % that option. % \begin{macrocode} - \setkeys[ytableau]{setup}{nosmalltableaux}% - \compare@YT{#1}{normal}% - \ifeq@YT% - \global\boxdim@YT=\boxdim@normal@YT% - \else% - \global\boxdim@YT=#1% - \fi% + \pgfkeysalso{nosmalltableaux}% + \compare@YT{#1}{normal}% + \ifeq@YT + \xdef\macro@boxdim@YT{\expandonce@YT\boxdim@normal@YT}% + \else + \xdef\macro@boxdim@YT{#1}% + \fi + } } +\pgfkeys{/ytableau/options, % \end{macrocode} -% \end{option} -% % \begin{option}{aligntableaux} % Most general alignment option, can be any of |top|, |center|, or |bottom|. +% \end{option} +% \begin{macrocode} + 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}}, +% \end{macrocode} % \begin{option}{centertableaux} +% |centertableaux| is |aligntableaux = center|. +% \end{option} +% \begin{macrocode} + centertableaux/.value forbidden, + centertableaux/.style = {aligntableaux/center}, +% \end{macrocode} % \begin{option}{nocentertableaux} -% |centertableaux| is |aligntableaux = center|, \\ % |nocentertableaux| is |aligntableaux = top|. +% \end{option} % \begin{macrocode} -\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}% + nocentertableaux/.value forbidden, + nocentertableaux/.style = {aligntableaux/top} } % \end{macrocode} -% \end{option} -% \end{option} -% \end{option} -% +% +% \changes{v1.2}{2012/06/17}{Fixed a bug in \texttt{textmode} and \texttt{smalltableaux} where \texttt{\textbackslash scriptstyle} was used outside of math mode.} +% \begin{macro}{\ifsmalltableaux@YT} +% \changes{v1.2}{2012/06/17}{Added.} +% This conditional tracks whether we are operating under the option |smalltableaux|. +% \end{macro} +% \begin{macrocode} +\newif\ifsmalltableaux@YT +\pgfkeys{/ytableau/options, +% \end{macrocode} % \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% + smalltableaux/.default = true, + smalltableaux/.is choice, + smalltableaux/true/.code = {% % \end{macrocode} -% 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. +% We check 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} - \ifnum\boxdim@save@YT>0% - \gdef\defarg@YT{\scriptstyle}% - \global\boxdim@save@YT=-\boxdim@YT% + \ifsmalltableaux@YT\else + \global\smalltableaux@YTtrue + \gdef\font@YT{\smallfont@YT}% % \end{macrocode} -% Arrived at by eyeballing. Exactly fits an |$f$|. +% We expand once here and later so that |\macro@boxdim@YT| can be evaluated lazily. % \begin{macrocode} - \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% -} -\define@boolkey[ytableau]{setup}{nosmalltableaux}[true]{% - \ifytableau@setup@nosmalltableaux% - \setkeys[ytableau]{setup}{smalltableaux=false}% - \else% - \setkeys[ytableau]{setup}{smalltableaux=true}% - \fi% -} + \xdef\boxdim@save@YT{\expandonce@YT\macro@boxdim@YT}% +% \end{macrocode} +% This one must be a |\def| rather than an |\edef| because |\refhtdp@YT| is not set until later. +% \begin{macrocode} + \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}, % \end{macrocode} % \end{option} +% \begin{option}{nosmalltableaux} +% \changes{v1.1}{2011/01/31}{Correctly reassign a positive value to \texttt{\textbackslash boxdim@save@YT} when exiting small tableaux.} +% |nosmalltableaux| resets everything to the way it was before |smalltableaux| was passed. +% \begin{macrocode} + nosmalltableaux/.value forbidden, + nosmalltableaux/.style = {smalltableaux/false} +% \end{macrocode} % \end{option} -% +% \begin{macrocode} +} +\pgfkeys{/ytableau/options, +% \end{macrocode} % \begin{option}{textmode} +% Requests that the boxes in tableaux be typeset in text mode rather than the default math mode. +% \begin{macrocode} + textmode/.value forbidden, + textmode/.code = \set@textmode@YT, +% \end{macrocode} +% \end{option} % \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\skipin@YT{\ignorespaces}% - \global\def\skipout@YT{\unskip}% - \else% - \global\def\skipin@YT{$}% - \global\def\skipout@YT{$}% - \fi% -} -\define@boolkey[ytableau]{setup}{mathmode}[true]{% - \ifytableau@setup@mathmode% - \setkeys[ytableau]{setup}{textmode=false}% - \else% - \setkeys[ytableau]{setup}{textmode=true}% - \fi% +% The inverse of |textmode|. +% \end{option} +% \begin{macrocode} + mathmode/.value forbidden, + mathmode/.code = \set@mathmode@YT, } % \end{macrocode} +% +% \begin{macro}{\ifbaseline@YT} +% \changes{v1.2}{2012/06/17}{Added.} +% Whether or not to create a baseline in the tableau boxes. +% \begin{macrocode} +\newif\ifbaseline@YT +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\pgfkeys{/ytableau/options, +% \end{macrocode} +% \begin{option}{baseline} +% \changes{v1.2}{2012/06/17}{Added option.} +% Switches whether the cells of the tableau should have their sizes normalized (and thus establish a common baseline in each row). Enabling it (the default) improves the appearance of text and symbols. +% \begin{macrocode} + baseline/.is if = baseline@YT, + baseline/.default = true, +% \end{macrocode} % \end{option} +% \begin{option}{nobaseline} +% \changes{v1.2}{2012/06/17}{Added option.} +% Synonymous with |baseline = false|. Improves the appearance of tableaux with numbers in their cells. +% \begin{macrocode} + nobaseline/.style = {baseline = false}, +% \end{macrocode} +% \end{option} +% \begin{option}{centerboxes} +% \changes{v1.2}{2012/06/17}{Added option.} +% Synonymous with |baseline = false|. % \end{option} -% -% Now the default option, where one can ask \textsf{xcolor} for things. % \begin{macrocode} -\DeclareOptionX*{\PassOptionsToPackage{\CurrentOption}{xcolor}} + centerboxes/.style = {baseline = false}, +} % \end{macrocode} -% -% Process the options now. We don't really need to be so specific but it doesn't hurt. Then we -% load \textsf{xcolor} with the options we may have collected. +% +% \changes{v1.2}{2012/06/17}{No longer pass options to \textsf{xcolor}.} +% Process the options now. Then we load \textsf{xcolor}. % \begin{macrocode} -\ProcessOptionsX[ytableau][] +\ytableausetup{nosmalltableaux,mathmode,baseline} +\RequirePackage{pgfopts} +\ProcessPgfPackageOptions{/ytableau/options} \RequirePackage{xcolor} % \end{macrocode} % % \subsection{\texttt{ytableau} environment} +% \changes{v1.2}{2012/06/17}{Fixed a bug where the widths of the outer rules of the tableau were ignored.} % % \begin{environment}{ytableau} % The core tableau-drawing environment. The first argument, which is optional, is just @@ -927,19 +1063,35 @@ % designating a nesting! (We will use this fact later, actually.) But we can't just write |{| and % (in |\endytableau|) |}| either. % \begin{macrocode} - \global\setbox\thistableau@YT=\vtop{\iffalse}\fi% - \setlength{\fboxrule}{\boxframe@YT}% - \setlength{\fboxsep}{0pt}% + \global\setbox\thistableau@YT=\vtop{\iffalse}\fi +% \end{macrocode} +% \begin{macro}{\none} +% \changes{v1.2}{2012/06/17}{Moved definition inside \texttt{\textbackslash ytableau}.} +% This one is for omitting entries but leaving their space. We also allow something to be placed +% in the empty space (e.g.\ |\dots|), but don't allow color (that would defeat the purpose of +% 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\none@YT} +% \end{macrocode} +% \end{macro} +% Now we set all the dimensions that depend on the font. +% \changes{v1.2}{2012/06/17}{Use \texttt{(} for \texttt{\textbackslash refhtdp@YT} rather than \texttt{$bg$}.} +% \begin{macrocode} + \setbox\refhtdp@YT=\hbox{\skipin@YT\font@YT (\skipout@YT}% + \boxdim@YT=\macro@boxdim@YT\relax + \fboxrule=\boxframe@YT\relax + \fboxsep=0pt % % \end{macrocode} % I hate |\cr|, let's use the \LaTeX\ convention. % \begin{macrocode} - \let\\=\cr@YT% + \let\\=\cr@YT % \end{macrocode} -% Lines and columns should abut, accounting for the fact that each entry is framed. +% Lines and columns should abut, accounting for the fact that each entry is framed. The first entry should not have any skip, since the first rule is not doubled. % \begin{macrocode} - \offinterlineskip% - \openup-\fboxrule% - \tabskip=-\fboxrule% + \tabskip=0pt % + \offinterlineskip + \openup-\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 @@ -964,15 +1116,15 @@ % |##| properly. Since we are \emph{still} inside an |\halign|, eventually it will expand % |\endytableau| and |##| will terminate properly. Whew. % \begin{macrocode} - \halign\bgroup&\startbox@YT{\defarg@YT}{#1}##% - \endbox@YT\cr% + \halign\bgroup&\tabskip=-\fboxrule + \startbox@YT{\font@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. % \begin{macrocode} - \crcr\egroup% + \crcr\egroup \iffalse{\fi}% % \end{macrocode} % Support for chaining. We allow |\endytableau| to be followed by |*[...]{...}|, which is fed to @@ -981,22 +1133,27 @@ % insert things in it. % \changes{v1.1}{2010/11/10}{Save the box width difference rather than the larger width.} % \begin{macrocode} - \ifnum\wd\thistableau@YT>\wd\tableaux@YT% - \tableauwd@YT=\wd\thistableau@YT% - \advance\tableauwd@YT by -\wd\tableaux@YT% - \else% - \tableauwd@YT = 0pt% - \fi% + \ifnum\wd\thistableau@YT>\wd\tableaux@YT + \tableauwd@YT=\wd\thistableau@YT +% \end{macrocode} +% This prevents the last rule from being ignored, as it is not doubled. +% \begin{macrocode} + \advance\tableauwd@YT by \fboxrule + \wd\thistableau@YT = \tableauwd@YT + \advance\tableauwd@YT by -\wd\tableaux@YT + \else + \tableauwd@YT = 0pt % + \fi % \end{macrocode} % 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\thistableau@YT=0pt% - \setbox\tableaux@YT% - =\hbox{\box\thistableau@YT\unhbox\tableaux@YT% + \wd\thistableau@YT=0pt % + \setbox\tableaux@YT + =\hbox{\box\thistableau@YT\unhbox\tableaux@YT \kern\tableauwd@YT}% - \ifstar@YT% + \ifstar@YT {\ydiagram}% {% % \end{macrocode} @@ -1004,16 +1161,16 @@ % 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% + \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 }% } % \end{macrocode} @@ -1026,55 +1183,47 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\none} -% This one is for omitting entries but leaving their space. We also allow something to be placed -% in the empty space (e.g.\ |\dots|), but don't allow color (that would defeat the purpose of -% 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\none@YT} -% \end{macrocode} -% \end{macro} -% +% \changes{v1.2}{2012/06/17}{Fixed a bug in \texttt{\textbackslash none} where text outside the optional argument would be typeset off-grid.} % \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. +% by replacing the actual frame with the frame separation. We use |\nullfont| after the box +% so as to forbid any "out of alignment" characters, which would appear between columns. +% Anything outside of the optional argument is simply ignored to the end of the cell. % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} % % \begin{macro}{\startbox@YT} -% |#1| = general formatting, |#2| = specific formatting. +% |#1| = font style, |#2| = optional material. % We want to extract the colors from each and then pass the whole thing on to |\startbox@@YT|. % \begin{macrocode} \def\startbox@YT#1#2{% % \end{macrocode} % We get the colors and then put the rest into temporary token registers. % \begin{macrocode} - \getcolor@YT{\save@YT{\opttoksa@YT}}#1\@nil% - \getcolor@YT{\save@YT{\opttoksb@YT}}#2\@nil% + \getcolor@YT{\save@YT{\opttoksa@YT}}#1\nil@YT + \getcolor@YT{\save@YT{\opttoksb@YT}}#2\nil@YT % \end{macrocode} % Now we get the color from the entry and proceed. % \begin{macrocode} - \getcolor@YT% + \getcolor@YT {\startbox@@YT\the\opttoksa@YT\the\opttoksb@YT}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\save@YT} -% Stick the following text into the token register in |#1|. Note that we use |\@nil| as an +% Stick the following text into the token register in |#1|. Note that we use |\nil@YT| as an % end-marker; it is not actually defined, so hopefully we never expand it! % \begin{macrocode} -\def\save@YT#1#2\@nil{#1={#2}} +\def\save@YT#1#2\nil@YT{#1={#2}} % \end{macrocode} % \end{macro} % @@ -1102,12 +1251,12 @@ % \end{macrocode} % Use a |\bgroup|...|\egroup| so as not to introduce nesting that would block |&| or |\cr|. % \begin{macrocode} - \setbox\thisbox@YT=\hbox to \boxdim@YT\bgroup% - \hss% - \skipin@YT% + \setbox\thisbox@YT=\hbox to \boxdim@YT\bgroup + \hss + \skipin@YT } % \end{macrocode} -% Since we are now in the intended typesetting context (i.e. an hbox with math mode on) +% 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| (= |\\|) % \end{macro} % @@ -1115,16 +1264,18 @@ % Now we can finish the box and set it. % \begin{macrocode} \def\endbox@YT{% - \skipout@YT% - \hss% - \egroup% + \skipout@YT + \hss + \egroup % \end{macrocode} % We want all the boxes to have a consistent baseline, so we normalize them to the same size. % 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\thisbox@YT=\ht\refhtdp@YT% - \dp\thisbox@YT=\dp\refhtdp@YT% + \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}% }% @@ -1140,22 +1291,23 @@ % \begin{macrocode} \def\fcolorbox@YT#1#2{% \compare@@YT{#1}{clear}% - \ifeq@YT% + \ifeq@YT % \end{macrocode} % Clear background; don't draw anything. % \begin{macrocode} \fbox{#2}% - \else% + \else % \end{macrocode} % Colored background; pass it to |\fcolorbox|. % \begin{macrocode} \fcolorbox{.}{#1}{#2}% - \fi% + \fi } % \end{macrocode} % \end{macro} % % \subsection{\texttt{ytableaushort} command} +% \changes{v1.2}{2012/06/17}{Fixed a bug in \texttt{\textbackslash ytableaushort} where \texttt{\{,\}} was treated as a comma at the beginning of a line.} % % \begin{macro}{\ytableaushort} % The short form of |ytableau|. It takes a comma-separated list of lines, each one a string of @@ -1167,8 +1319,8 @@ % |\endytableau| has to be right at the end, so we can't use scope to reset |\toks@YT|. % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} @@ -1192,70 +1344,66 @@ % We pass |#3| back as an \emph{argument} to |\getline@@YT|, thus avoiding the braces issue. % \begin{macrocode} \edef\next@YT{\the\opttoksb@YT{\the\opttoksa@YT}}% - \next@YT% +% \end{macrocode} +% We use |\futurelet| to check whether the next token is |\nil@YT| without breaking brace groups. +% \begin{macrocode} + \futurelet\tmpa@YT\next@YT } % \end{macrocode} % \end{macro} % % \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\getline@@YT#1#2#3#4{% -% \end{macrocode} -% Handle double commas or trailing commas. -% \begin{macrocode} - \compare@YT{#4}{,}% - \ifeq@YT% -% \end{macrocode} -% Try again. -% \begin{macrocode} - \def\next@YT{\getline@@YT{#1}{#2}{#3}}% - \else% -% \end{macrocode} +% |#2| = the junk to put after each row (followed by |\nil@YT|), +% |#3| = everything before the first comma. % If this is not the last row, we have to recurse down the list. Otherwise, just process the -% current row. -% \begin{macrocode} - \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 |\fullexpand@YT| when we don't want them. +% current row. Multiple commas are ignored. % \begin{macrocode} - \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 } % \end{macrocode} % \end{macro} % % \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. +% Takes two tokens and checks if the second is |\nil@YT|, which means the first is the last entry. % \begin{macrocode} \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} - \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 } % \end{macrocode} % \end{macro} % % \subsection{\texttt{ydiagram} commmand} +% \changes{v1.2}{2012/06/17}{Fixed a bug where giving a line length of 0 in \texttt{\textbackslash ydiagram} did not draw an empty row, but rather ignored the row.} +% \changes{v1.2}{2012/06/17}{Removed \texttt{\textbackslash fullexpand@YT}.} % % \begin{macro}{\ydiagram} % Takes the same optional argument as the other macros. Its main argument |#2| is of the form @@ -1270,8 +1418,8 @@ % We need |\endytableau| to be right at the end, so we can't use scope to reset |\toks@YT|. % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} @@ -1279,28 +1427,28 @@ % \begin{macro}{\getnumbers@YT} % Separates the entries in a line of |\ydiagram| and reformats them for |\ytableau|. % \begin{macrocode} -\def\getnumbers@YT#1+#2\@nil{% +\def\getnumbers@YT#1+#2\nil@YT{% % \end{macrocode} % If |#2| = |{}|, then there is no offset and |#1| is the row shape. % \begin{macrocode} \compare@YT{#2}{}% - \ifeq@YT% + \ifeq@YT \def\next@YT{% \loop@YT{#1}{}% }% % \end{macrocode} % Else |#1| is the offset and |#2| is the shape. % \begin{macrocode} - \else% + \else \def\next@YT{% \loop@YT{#1}{\none}% % \end{macrocode} % Now |#2| looks like \meta{number}|+|, so we feed it back in. % \begin{macrocode} - \getnumbers@YT#2\@nil% + \getnumbers@YT#2\nil@YT }% - \fi% - \next@YT% + \fi + \next@YT } % \end{macrocode} % \end{macro} @@ -1310,49 +1458,32 @@ % The results go in |\toks@YT|. % \begin{macrocode} \def\loop@YT#1#2{% -% \end{macrocode} -% Fills |\count@YT|. -% \begin{macrocode} - \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% + \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\count@YT=1% + \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% -} + \fi + \else % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\fullexpand@YT} -% Fully expand its argument. Hopefully you passed an argument for which that makes sense. -% This also strips braces. +% This supports using 0 as a number: it inserts an empty line, but only if it is the |+0| case, not the |0+| case. % \begin{macrocode} -\def\fullexpand@YT#1{% -% \end{macrocode} -% TeX's brace parser will strip the braces for us. -% \begin{macrocode} - \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\tmpb@YT{\tmpa@YT#1}% - \edef\tmpc@YT{\tmpb@YT}% - \count@YT=\tmpc@YT% + \compare@YT{#2}{}% + \ifeq@YT + \toks@YT=\expandafter{\the\toks@YT\none\\}% + \fi + \fi } % \end{macrocode} % \end{macro} -% -% \Finale \ No newline at end of file +% \Finale diff --git a/Master/texmf-dist/source/latex/ytableau/ytableau.ins b/Master/texmf-dist/source/latex/ytableau/ytableau.ins index 42ec297c3bf..e54b845d746 100644 --- a/Master/texmf-dist/source/latex/ytableau/ytableau.ins +++ b/Master/texmf-dist/source/latex/ytableau/ytableau.ins @@ -21,7 +21,7 @@ This is a generated file. -Copyright (C) 2010 by Ryan Reich +Copyright (C) 2010--2012 by Ryan Reich This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.2 of this license 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 +%% Copyright (C) 2010--2012 by Ryan Reich %% %% 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][] +\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 %% -- cgit v1.2.3