1

EDIT : I added some examples to illustrate what I want to do.

I would like to be able to draw nested Young tableaux. For a definition of Young tableaux, see https://en.wikipedia.org/wiki/Young_tableau. What I mean by nested is that the content of a cell of a tableau is itself a tableau. For example, my result should look like this :

enter image description here

In general, rows and columns can be of any length. Here is another example to illustrate what I want to be able to do:

enter image description here

Because I also want tabloids and column-tabloids, I draw my tableaux using the method in this answer (instead of the packages ytableau or genyoungtabtikz) :

column tabloids versus row tabloids

However, I am not used to tikz, and it does not work as I would like. There is a minimal code for my first example (I used \Tableau and \PTableau so that the computer does not confuse both methods):

\documentclass{article}

\usepackage{tikz}

\newcount\tableauRow\newcount\tableauCol \newcommand\Tableau[2]{% \begin{tikzpicture}[scale=#2,draw/.append style={thick,black},baseline=-4mm] \tableauRow=0 \foreach \Row in {#1} { \tableauCol=1 \foreach\k in \Row { \draw(\the\tableauCol,\the\tableauRow)+(-.5,-.5)rectangle++(.5,.5); \draw(\the\tableauCol,\the\tableauRow)node{\k}; \global\advance\tableauCol by 1 } \global\advance\tableauRow by -1 } \end{tikzpicture} } \newcommand\PTableau[2]{% \begin{tikzpicture}[scale=#2,draw/.append style={thick,black},baseline=-4mm] \tableauRow=0 \foreach \Row in {#1} { \tableauCol=1 \foreach\k in \Row { \draw(\the\tableauCol,\the\tableauRow)+(-.5,-.5)rectangle++(.5,.5); \draw(\the\tableauCol,\the\tableauRow)node{\k}; \global\advance\tableauCol by 1 } \global\advance\tableauRow by -1 } \end{tikzpicture} }

\begin{document}

[ \PTableau{{\Tableau{{1,2},{3,4}}{0.5},\Tableau{{5,6},{7,8}}{0.5}}}{1.5} ]

\end{document}

With this code, the result looks like this instead of what I want (I drew it because of computer problem, but it illustrates the problem):

enter image description here

What should I modify to \PTableau so that I obtain the result I want? And mostly, why?

eti902
  • 165
  • 1
    Thanks for providing code. Note that you are much better off just saying what you want to change. If something about these diagrams is crucial, explain it. Don't expect people to start reading Wikipedia articles in order to even figure out if they might be able to help. Most of them won't. – cfr Feb 01 '24 at 05:42
  • 2
    Nesting tikzpictures isn't supported and typically breaks. It should always be avoided unless you know what you are doing and it should almost always be avoided even if you do. – cfr Feb 01 '24 at 05:46
  • 1
    Don't nest tikzpictures, use \pics instead. Could you post a picture of how the expected output should look like? – Jasper Habicht Feb 01 '24 at 10:13
  • Regarding your edit: You only want to nest once, right? So, you effectively want to place a Young tableau (of whatever size) inside the cell of another, but with some padding? – Jasper Habicht Feb 01 '24 at 21:28
  • Yes, this is exactly what I want. – eti902 Feb 01 '24 at 21:44

1 Answers1

1

Not sure whether the output is what you imagine, but here is an approach using \pics that are not really nested, but stacked upon each other so that the result looks like they are nested:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}

\tikzset{ pics/tableau/.style={ code={ \tikzset{tableau/.cd, #1} \pgfmathsetmacro{\s}{\pgfkeysvalueof{/tikz/tableau/size}1pt} \pgfmathsetmacro{\c}{\pgfkeysvalueof{/tikz/tableau/cols}} \begin{scope}[ shift={(\pgfkeysvalueof{/tikz/tableau/at})}, ] \foreach \n [count=\i from 0] in \tableaulist { \path[\ifx\n\empty\else draw\fi] ({mod(\i,\c)\s},{int(-1\i/\c)\s}) coordinate (-\i) rectangle ++({\s},{-1*\s}) node[pos=0.5] (-n\i) { \n }; } \end{scope} } }, tableau/list/.store in=\tableaulist, tableau/list/.initial={1}, tableau/cols/.initial={2}, tableau/size/.initial={1}, tableau/at/.initial={0,0} }

\begin{document} \begin{tikzpicture}

\pic (A) {tableau={list={1,{},9,10,11,{},12,{},20}, cols=3}};

\pic[tableau/size=0.5] (B) {tableau={list={2,3,{},8}, cols=2, at=A-1}};

\pic[tableau/size=0.25, font=\tiny] {tableau={list={4,5,6,7}, cols=2, at=B-2}};

\pic[tableau/size=0.333, font=\tiny] {tableau={list={13,14,15,16,17,18,{},{},19}, cols=3, at=A-7}};

\end{tikzpicture} \end{document}

enter image description here

  • Hi, thank you for taking the time to answer my question. I added some examples of what I want to do. Meanwhile, I will look at the \pic documentation to have a better understanding of what you did! It is almost what I want. – eti902 Feb 01 '24 at 18:24