2

I would like to draw a staircase path in a young tableau that uses the sides of the boxes in the tableau as steps.

For example, in the tableau

\documentclass[border=2mm]{standalone}
\usepackage{ytableau}
\begin{document}
\ytableausetup
{boxsize=1.25em}
\ytableausetup
{aligntableaux=top}
\begin{ytableau}
*(blue!40) 1& *(blue!40) 3 &*(blue!40) 5 &7&9\\
*(blue!40) 2 & *(blue!40) 4 &8&10&11
\end{ytableau}
\end{document}  

I would like to have the bottom side of the box with the entry 2 as the first step, then bottom of box 4, then right side of box 4, bottom of box 5, right side of box 5, top box 7, top box 9.

The colors are not important, they're there for convenience, as long as there is this path drawn across the tableaux.

Any ideas?

2
  • Please complete your code to create a compilable document (Minimum Working Example) starting with \documentclass{} and ending with \end{document} which includes the packages necessary for the code you posted. This is much more useful than a mere fragment.
    – cfr
    Aug 24, 2014 at 14:01
  • I have no solution, but I can confirm that it is not currently possible with my package, though it's nice of you to make a tag for it :)
    – Ryan Reich
    Aug 24, 2014 at 22:58

2 Answers 2

5

tikz package can be used for this purpose. We can consider this tableau as the text within a node and draw the staircase consequently. We use varwidth package here to made the node as compact as possible. The proposed code is as follows:

\documentclass[border=2mm]{standalone}
\usepackage{ytableau,tikz,varwidth}
\usetikzlibrary{calc}
\begin{document}

\begin{tikzpicture}[inner sep=0in,outer sep=0in]
\node (n) {\begin{varwidth}{5cm}{
\begin{ytableau}
*(blue!40) 1 & *(blue!40) 3 & *(blue!40) 5 &7  &9\\
*(blue!40) 2 & *(blue!40) 4 & 8            &10 &11
\end{ytableau}}\end{varwidth}};
\draw[thick,orange] (n.south west)--([xshift=1.09cm]n.south west)--([xshift=1.09cm]n.west)--([xshift=-1.09cm]n.east)--([xshift=-1.09cm]n.north east)--(n.north east);
\end{tikzpicture}
\end{document}

With the expected output:

enter image description here

As per Combin's comment, we can perform this solution to an arbitrary tableau. It is only a matter of knowing the cell size. Here is another example of a skew tableau:

\documentclass[border=2mm]{standalone}
\usepackage{ytableau,tikz,varwidth}
\usetikzlibrary{calc}
\begin{document}

\begin{tikzpicture}[inner sep=0in,outer sep=0in]
\node (n) {\begin{varwidth}{5cm}{
\ytableausetup{notabloids}
\begin{ytableau}
\none & \none & *(blue!40)1 & 2 \\
\none & *(blue!40)1 & 2 \\
*(blue!40)1 & 2 \\
2
\end{ytableau}}\end{varwidth}};
\draw[very thick,orange] ([yshift=-.5*1.09cm]n.west)--++(.5*1.09,0)--++(0,.5*1.09)--++(.5*1.09,0)--++(0,.5*1.09)--++(.5*1.09,0)--++(0,.5*1.09)--++(.5*1.09,0);
\end{tikzpicture}
\end{document}

Now the output is like this:

enter image description here

As a variant, try the following tikz solution. It requires two runs one to calculate the positions and a second to draw. Here is the proposed code (inspired by an answer by Peter Grill to this question):

\documentclass[border=2mm]{standalone}
\usepackage{ytableau}
\usepackage{tikz}
\begin{document}

\newcommand{\tikzmark}[2]{\tikz[overlay,remember picture,baseline] \node [anchor=base] (#1) {$#2$};}

\newcommand{\DrawVLine}[3][]{%
  \begin{tikzpicture}[overlay,remember picture]
    \draw[shorten >=0.2mm,shorten <=-0.1mm, #1] ([xshift=0.1mm]#2.south east) -- ([xshift=0.1mm]#3.north east);
  \end{tikzpicture}
}

\newcommand{\DrawHLine}[3][]{%
  \begin{tikzpicture}[overlay,remember picture]
    \draw[shorten <=-0.2mm,shorten >=-0.1mm, #1] (#2.south west) -- (#3.south east);
  \end{tikzpicture}
}

\newcommand{\DrawHLineAbove}[3][]{%
  \begin{tikzpicture}[overlay,remember picture]
    \draw[shorten >=-0.2mm, #1] ([yshift=-0.3mm]#2.north east) -- ([yshift=-0.31mm]#3.north east);
  \end{tikzpicture}
}

\ytableausetup
{boxsize=1.25em}
\ytableausetup
{aligntableaux=top}
\begin{ytableau}
 1&  3 &\tikzmark{b-5}{5}&7&\tikzmark{b-9}{9}\\
\tikzmark{b-2}{2} & \tikzmark{b-4}{4}&8&10&11
\end{ytableau}

\DrawHLine[blue, thick]{b-2}{b-4}
\DrawVLine[blue, thick]{b-4}{b-4}
\DrawHLine[blue, thick]{b-5}{b-5}
\DrawVLine[blue, thick]{b-5}{b-5}
\DrawHLineAbove[blue, thick]{b-5}{b-9}

\end{document} 

The output to this is:

enter image description here

2
  • Thank you so much! I think your first solution is the one that works best with my problem: this is not the unique tableau that I am considering, I am working with tableaux of different sizes, not necessarily rectangular, and in which the path within the tableau change. I feel I have to treat each case separately and end up with a long, long code.
    – Combin
    Aug 25, 2014 at 8:20
  • @Combin See my updated answer
    – AboAmmar
    Aug 25, 2014 at 11:32
2

[Edit: improved syntax and illustrating how to to cope with different shapes, answering the OP's query in the comments..]

I agree with AboAmmar that tikz is a good approach. Here is a slightly shorter solution where the main difference is that it uses tikz to draw the tableau, resulting in a number of shortcuts. Here is the result of, first, drawing a tableau normally and, secondly, inserting this same code into a another tikzpicture environment so that the blue lines can be drawn:

enter image description here

I have rewritten my original code so that it looks nicer and is easier to use. I have also added the third example above to show how to do a three-rowed tableau -- arbitrary shapes are fine.

The example code below defines a Tableau environment for drawing a tableau and that then allows arbitrary tikz code to appear after the tableau. There is also a "shortcut" macro \tableau that draws an ordinary tableau without any additional decorations.

With both the Tableau environment and \tableau macro the entries of the tableau are specified as "comma separated lists" like `{{1,3,5,7,9},{2,4,8,10,11}}. This defines a two-rowed tableau with 1 3 5 7 9 in the first row and 2,4,8,10,11 in the second row. You can specify an arbitrary number of rows and columns with any reasonable entries this way.

Here is the full latex code:

\documentclass{article}
\usepackage{tikz}
\usepackage{xparse}

\newcount\tableauRow
\newcount\tableauCol
\def\tableauDim{0.4}
\newenvironment{Tableau}[1]{%
  \tikzpicture[scale=0.4,draw/.append style={thick,black},
                      baseline=(current bounding box.center)]
    % now draw the tableau
    \tableauRow=-1.5
    \foreach \Row in {#1} {
       \tableauCol=0.5
       \foreach\k in \Row {
         \draw[thin](\the\tableauCol,\the\tableauRow)rectangle++(1,1);
         \draw[thin](\the\tableauCol,\the\tableauRow)+(0.5,0.5)node{$\k$};
         \global\advance\tableauCol by 1
       }
       \global\advance\tableauRow by -1
    }
}{\endtikzpicture}
\newcommand\tableau[1]{\begin{Tableau}{#1}\end{Tableau}}

\begin{document}

\begin{tabular}{l@{\qquad}l@{\qquad}l}
  \tableau{{1,3,5,7,9},{2,4,8,10,11}}
&
  \begin{Tableau}{{1,3,5,7,9},{2,4,8,10,11}}
      \draw[very thick,blue] (0,-2)--(2,-2)--(2,-1)--(3,-1)--(3,0)--(5,0);
  \end{Tableau}
&
  \begin{Tableau}{{1,5,7,9},{2,4,10,11},{3,8,14}}
    \draw[very thick,blue](0,-3)--(2,-3)--(2,-2)--(3,-2)--(3,-1)--(4,-1)--(4,0);
  \end{Tableau}
\end{tabular}

\end{document}

Btw, I have changed the code so that the boxes not sit on the "obvious" integer lattice points.

It's also easy to colour the boxes in this way and do many other things. I use these macros in my own papers -- although the trick of using an environment for decorating the tableaux is something that I only just thought of when editing this, so thanks:)

2
  • Thank you so much! It is a very neat solution to the problem. I am trying to work with tableaux of different sizes, not necessarily rectangular, and in which the path within the tableau change. I feel I have to treat each case separately and end up with a long, long code?
    – Combin
    Aug 25, 2014 at 8:18
  • My solution caters for tableaux of arbitrary shape. I will edit my solution to show this...and at the same time I will improve the syntax above as it is slightly ungainly.
    – user30471
    Aug 26, 2014 at 4:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .