TikZ-PGF – Drawing Young Tabloids

matricesparsingtablestikz-pgfytableau

I would like LaTeX to produce output like the following

example of a tabloid

(without the 2 a so called Young tabloid), ideally by writing

\ytabloidshort{123,56}

(using one character per cell, ideally allowing groups via brackets as in
\ytabloidshort{89{10}{\ldots}{n+1},56}, but that is not important, the following is sufficient) or

\begin{ytabloid}
1 & 2 & 3 \\
4 & 5
\end{ytabloid}

of course with arbitrarily many rows and columns. The command/environment must (also or only) work in mathmode. That's why I included the 2 \cdot in the following examples.

I have found several ways to generate output similar to the desired, but they are all unacceptable.

\documentclass{article}

\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{ytableau}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}

perfect, but I do not see a way to remove the vertical lines while keeping the 
horizontal ones (ytableau):
\[ 2 \cdot
\ytableausetup{centertableaux}
\begin{ytableau}
1 & 2 & 3 \\
4 & 5
\end{ytableau}
\]

matrix (amsmath) and cline:
\[ 2 \cdot
\begin{matrix}
\hline
1 & 2 & 3 \\ \hline
4 & 5 \\ \cline{1-2}
\end{matrix}
\]

matrix (amsmath) and cmidrule (booktabs):
\[ 2 \cdot
\cmidrulewidth=\lightrulewidth
\begin{matrix}
\midrule
1 & 2 & 3 \\ \midrule
4 & 5 \\ \cmidrule{1-2}
\end{matrix}
\]

tikzpicture and matrix (TikZ/PGF with library matrix):
\[ 2 \cdot
\begin{tikzpicture}
\matrix[matrix of math nodes] (m) {
1&2&3\\
4&5\\
};
\draw (m-1-1.north west) -- (m-1-3.north east);
\draw (m-1-1.south west) -- (m-1-2.south east);
\draw[red] (m-2-2.north west) -- (m-2-2.north east); % shows that lines don't overlap
\draw (m-2-1.south west) -- (m-2-2.south east);
\end{tikzpicture}
\]

\end{document}

Two (and more) disadvantages remain:

  • The output is ugly, actually unusable.
  • They are all very uncomfortable to write.

What do you suggest?

Is it, for example, possible to parse the argument of \ytabloidshort and draw a matrix, each cell with content automatically with a line above and below. (But note the "problem in red"). How would one implement such a \newcommand? Any other ideas are also welcome.

I can split this problem into three questions:

  1. How do I get tabloids whose appearance fits to tableaux generated with the package ytableau?
  2. How can I make the result of (1.) work in connection with other maths, cf. the 2 \cdot?
  3. How can I generate (1.) in a comfortable way?

Solutions so far:

Ryan extented his package ytableau to draw tabloids. As long as your are using the package, this solves all three questions. The picture above can be generated by

\usepackage{ytableau} % version 1.3 or higher

\ytableausetup{tabloids, centertableaux}
\[ 2 \cdot \ytableaushort{123,45} \]

Sticking to the questions the status is the following.

  1. Actually none. Spacing must be adapted.
  2. Actually none. Alignment and spacing must be adapted.
  3. Scott showed a way to generate the desired matrix by a makro. This is definitely worth noting and may be helpful in many other situations.

Best Answer

I've expanded ytableau a little to include an option to draw tabloids.

\documentclass{standalone}
\usepackage{ytableau}
\begin{document}
  \ytableausetup{tabloids,centertableaux}
  $2\cdot\ytableaushort{123,45,6}$
\end{document}

enter image description here

Currently the new version is on my website and has also been uploaded to CTAN.